Mescode
; To enable / disable mescodifying all outgoing messages: | |
; /mescode [on|off] | |
; To enable / disable automatic translation of all mescode messages: | |
; /mescode translate [on|off] | |
; To convert (decode) a message from mescode to text: | |
; /mescode decode [message] | |
; To convert (encode) a message from text to mescode: | |
; /mescode encode [message] | |
Alias mescode { | |
if ( $1 = on ) { | |
%mescode = on | |
echo -a You're now speaking in mescode! | |
} | |
if ( $1 = off ) { | |
%mescode = off | |
echo -a You're no longer speaking in mescode... :( | |
} | |
if ( $1 = translate ) { | |
if ( $2 = on ) { | |
%translate = on | |
echo -a You can now understand mescode! | |
} | |
if ( $2 = off ) { | |
%translate = off | |
echo -a You can no longer understand mescode... :( | |
} | |
} | |
if ( $1 = encode ) { | |
set %usercommand true | |
set %method encode | |
set %msg $2- | |
sockclose test | |
sockopen test appspot.com 80 | |
} | |
if ( $1 = decode ) { | |
set %usercommand true | |
set %method decode | |
set %msg $2- | |
sockclose test | |
sockopen test appspot.com 80 | |
} | |
} | |
on ^*:TEXT:pgauigh*:#: { | |
if ( %translate == on ) { | |
sockclose test | |
sockopen test appspot.com 80 | |
set %meschan $chan | |
set %nick $+(<,$nick(#,$nick).pnick,>) | |
set %method decode | |
set %msg $replace($1-, $chr(32), $chr(37) $+ 20, $chr(35),$chr(37) $+ 23) | |
haltdef | |
} | |
} | |
on *:INPUT:#: { | |
if (($left($1,1) != /) && (%mescode == on)) { | |
sockclose test | |
sockopen test appspot.com 80 | |
set %meschan $chan | |
set %nick $+(<,$nick(#,$nick).pnick,>) | |
set %method encode | |
set %msg $replace($1-, $chr(32), $chr(37) $+ 20, $chr(35),$chr(37) $+ 23) | |
if (%translate == on) { echo %meschan %nick $1- } | |
haltdef | |
} | |
} | |
on *:sockopen:test: { | |
sockwrite -n $sockname GET /? $+ %method $+ = $+ %msg HTTP/1.0 | |
sockwrite -n $sockname Host: mrdvpfr.appspot.com | |
sockwrite -n $sockname | |
} | |
on *:sockread:test: { | |
var %x | |
sockread %x | |
while ($sockbr) { | |
if (__Result:__ isin %x) { | |
if ( %usercommand == true) { | |
set %usercommand false | |
if (%method == decode) { | |
echo -a Decoded message: $remove(%x, __Result:__) | |
} | |
if (%method == encode) { | |
echo -a Encoded message: $remove(%x, __Result:__ pgauigh: ) | |
} | |
} | |
else { | |
if ((%method == decode) || (%translate == off)) { | |
echo %meschan %nick $remove(%x, __Result:__) | |
} | |
if (%method == encode) { | |
.msg %meschan $remove(%x, __Result:__) | |
} | |
} | |
} | |
sockread -f %x | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment