Advertisement
westor

/IRC command line (aka Telnet) for Koragg v1.0

Feb 18th, 2021
2,102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 7.68 KB | None | 0 0
  1. ; --- Settings ---
  2.  
  3. alias -l irc_debug_font { return Verdana 14 }
  4. alias -l irc_debug_linesep { return $chr(15) }
  5. alias -l irc_debug_hide_raws { return 372 375 376 }
  6. alias -l irc_debug_hide_commands { return PING }
  7. alias -l irc_debug_incoming_color { return 5 }
  8. alias -l irc_debug_outgoing_color { return 12 }
  9. alias -l irc_debug_incoming_sign { return 🢀 }
  10. alias -l irc_debug_outgoing_sign { return 🢂 }
  11.  
  12. alias -l irc_default_nick { return IRC_Test }
  13. alias -l irc_default_ident { return IRC }
  14. alias -l irc_default_gecos { return mSL IRC Testing Client }
  15.  
  16. alias -l irc_user_params { return 0 * }
  17.  
  18. alias -l irc_ctcp_reply {
  19.   if ($1 == VERSION) { return mSL IRC Debug Client }
  20.   if ($1 == TIME) { return $fulldate }
  21.   if ($1 == FINGER) { return $fullname (AdiIRC $version $bits $+ Bit) }
  22.   if ($1 == USERINFO) { return $username ( $+ $fullname $+ ) }
  23.   if ($1 == CLIENTINFO) { return ABOUT ACTION CLIENTINFO DCC FINGER MACHINEGOD PING SOURCE TIME USERINFO VERSION }
  24.   if ($1 == SOURCE) { return https://adiirc.com }
  25.   if ($1 == ABOUT) { return http://www.findagrave.com/cgi-bin/fg.cgi?page=gr&GRid=10369601 }
  26.   if ($1 == MACHINEGOD) { return The machine god has $chr(2) $+ fallen $+ $chr(15) $+ , and the unbelievers $chr(31) $+ rejoiced $+ $chr(15) $+ . But from the debris rose new machines which will have their vengeance. ~The Book of Atheme, 10:31 }
  27. }
  28.  
  29. ; Enable that if you use "Making Internet Relay Crap" (mIRC)
  30. ;alias calias { return /IRC }
  31.  
  32. ; --- Settings ---
  33.  
  34. alias irc {
  35.   ; /irc <ip|hostname> <[+]port> [nick] [ident] [gecos]
  36.  
  37.   if (!$1) || (!$2) || ($2 !isnum 1-65535) { echo %win $irc_debug_linesep | echo 4 -ta * $calias $+ : Incorrect Syntax! - $calias <ip|hostname> <port> [nick] [ident] [gecos] | echo %win $irc_debug_linesep | return }
  38.  
  39.   var %temp = $+($1,:,$2)
  40.   var %sock = $+(irc_,%temp)
  41.   var %win = $+(@irc_,%temp)
  42.   var %hash = $+(IRC_,%temp)
  43.  
  44.   var %nick = $iif($3,$v1,$irc_default_nick)
  45.   var %ident = $iif($4,$v1,$irc_default_ident)
  46.   var %gecos = $iif($5,$5-,$irc_default_gecos)
  47.  
  48.   if ($hget(%hash)) { hfree $v1 }
  49.  
  50.   hmake %hash 100
  51.  
  52.   hadd %hash TARGET $1
  53.   hadd %hash PORT $2
  54.   hadd %hash NICK %nick
  55.   hadd %hash IDENT %ident
  56.   hadd %hash GECOS %gecos
  57.  
  58.   sockclose %sock
  59.  
  60.   if ($window(%win)) { window -a %win }
  61.   else { window -ek0j1000000 %win $irc_debug_font }
  62.  
  63.   echo -tc info %win IRC session started. ( $+ $fulldate $+ )
  64.  
  65.   echo %win $irc_debug_linesep
  66.  
  67.   echo -tc info2 %win IP/Host: $1 ( $+ $iif($iptype($1),$upper($v1),Host) $+ )
  68.   echo -tc info2 %win Port: $2 ( $+ $iif(+ isin $2,TLS/SSL,Plain) $+ )
  69.   echo -tc info2 %win IRC Nickname: %nick
  70.   echo -tc info2 %win IRC Ident: %ident
  71.   echo -tc info2 %win IRC Gecos: %gecos
  72.  
  73.   echo %win $irc_debug_linesep
  74.  
  75.   echo -tc info2 %win Connecting...
  76.  
  77.   echo %win $irc_debug_linesep
  78.  
  79.   if (+ isin $2) { sockopen -enI %sock $1 $remove($2,+) }
  80.   else { sockopen -n %sock $1 $2 }
  81.  
  82.   sockmark %sock %win %hash
  83. }
  84.  
  85. ON *:SOCKOPEN:irc_*: {
  86.   var %win = $gettok($sock($sockname).mark,1,32)
  87.   var %hash = $gettok($sock($sockname).mark,2,32)
  88.  
  89.   if ($sockerr) { echo 4 -t %win Connection Error! - Error Details: $sock($sockname).wsmsg | echo %win $irc_debug_linesep | return }
  90.  
  91.   echo -tc info2 %win Connection established.
  92.   echo %win $irc_debug_linesep
  93.  
  94.   sockwrite -nt $sockname NICK $hget(%hash,NICK)
  95.   sockwrite -nt $sockname USER $hget(%hash,IDENT) $irc_user_params : $+ $hget(%hash,GECOS)
  96.   sockwrite -nt $sockname $crlf
  97. }
  98.  
  99. ON *:SOCKREAD:irc_*: {
  100.   var %win = $gettok($sock($sockname).mark,1,32)
  101.   var %hash = $gettok($sock($sockname).mark,2,32)
  102.  
  103.   if ($sockerr) { echo 4 -t %win Connection Reading Error! - Error Details: $sock($sockname).wsmsg | echo %win $irc_debug_linesep | sockclose $sockname | return }
  104.  
  105.   var %r
  106.   sockread %r
  107.   tokenize 32 %r
  108.  
  109.   ; echo 13 %win READ: %r
  110.  
  111.   if (!$1-) || (!$sockbr) { return }
  112.  
  113.   if ($1 == PING) { sockwrite -nt $sockname PONG : $+ $remove($gettok($1-,2-,32),:) }
  114.  
  115.   if ($2 == PRIVMSG) && ($+(*,$chr(58),$chr(1),*,$chr(1),*) iswm $4) {
  116.     var %ctcp = $remove($4,$chr(1),$chr(58))
  117.     var %msg = $irc_ctcp_reply(%ctcp)
  118.  
  119.     if (%ctcp) && (%msg) { sockwrite -nt $sockname NOTICE $remove($gettok($1,1,33),:) $+(:,$chr(1),%ctcp %msg,$chr(1)) }
  120.   }
  121.  
  122.   if ($istok($irc_debug_hide_commands,$1,32)) || ($istok($irc_debug_hide_raws,$2,32)) { return }
  123.  
  124.   echo $irc_debug_incoming_color -t %win $irc_debug_incoming_sign %r
  125. }
  126.  
  127. ON *:SOCKCLOSE:irc_*: {
  128.   var %win = $gettok($sock($sockname).mark,1,32)
  129.  
  130.   echo %win $irc_debug_linesep
  131.  
  132.   echo -tc info2 %win Connection closed.
  133.  
  134.   echo %win $irc_debug_linesep
  135. }
  136.  
  137. ON *:CLOSE:@irc_*: {
  138.   var %sock = $remove($target,@)
  139.   var %hash = %sock
  140.  
  141.   if ($hget(%hash)) { hfree $v1 }
  142.  
  143.   sockclose %sock
  144. }
  145.  
  146. ON *:INPUT:@irc_*: {
  147.   if ($left($1,1) == $comchar) { return }
  148.  
  149.   var %win = $active
  150.   var %sock = $remove(%win,@)
  151.   var %hash = %sock
  152.   var %msg = $1-
  153.  
  154.   if ($istok(say msg,$1,32)) && ($2) && ($3) { var %msg = PRIVMSG $2 : $+ $3- }
  155.   if ($istok(me describe action,$1,32)) && ($2) && ($3) { var %msg = PRIVMSG $2 : $+ $chr(1) $+ ACTION $3- $+ $chr(1) }
  156.   if ($1 == ctcp) && ($2) && ($3) { var %msg = PRIVMSG $upper($2) : $+ $chr(1) $+ $3 $+ $chr(1) }
  157.   if ($1 == umode) && ($2) { var %msg = MODE $gettok($sock(%sock).mark,2,32) $2- }
  158.  
  159.   echo $irc_debug_outgoing_color -t %win $irc_debug_outgoing_sign %msg
  160.  
  161.   if ($1 == connect) { irc $iif(!$2,$hget(%hash,TARGET) $hget(%hash,PORT) $hget(%hash,NICK) $hget(%hash,IDENT) $hget(%hash,GECOS),$2-) }
  162.   if ($1 == disconnect) { sockclose %sock | echo %win $irc_debug_linesep | echo -tc info2 %win Connection terminated. | echo %win $irc_debug_linesep }
  163.   if ($1 == close) { sockclose %sock | echo %win $irc_debug_linesep | echo -tc info2 %win Connection terminated and closed. | echo %win $irc_debug_linesep | .timer -o 1 1 window -c %win }
  164.  
  165.   if (%sock) && ($sock(%sock)) { sockwrite -nt %sock %msg }
  166.  
  167.   halt
  168. }
  169.  
  170. menu @irc_* {
  171.   Clear: {
  172.     var %ask = $input(Do you wanna clear that session?,yqdh,Question)
  173.  
  174.     if (!%ask) { return }
  175.  
  176.     clear $menu
  177.   }
  178.   -
  179.   $iif($sock($remove($menu,@)),$style(2)) Connect: {
  180.     var %hash = $remove($menu,@)
  181.  
  182.     var %old_server = $hget(%hash,TARGET)
  183.     var %old_port = $hget(%hash,PORT)
  184.     var %old_nick = $hget(%hash,NICK)
  185.     var %old_ident = $hget(%hash,IDENT)
  186.     var %old_gecos = $hget(%hash,GECOS)
  187.  
  188.     var %ask1 = $input(Do you wanna re-connect on %old_server $+ : $+ %old_port ?,yqdu,Question)
  189.  
  190.     if (%ask1) { irc %old_server %old_port %old_nick %old_ident %old_gecos | return }
  191.  
  192.     var %ask2 = $input(Do you wanna create a new connection?,yqdu,Question)
  193.  
  194.     if (%ask2) {
  195.       var %s = $input(Enter the IP/Host.,eidu,Enter)
  196.  
  197.       if (!%s) { return }
  198.  
  199.       var %p = $input(Enter %s IP/Host Port. [NOTE: Use +PORT for TLS/SSL],eidu,Enter)
  200.  
  201.       if (!%p) { return }
  202.  
  203.       var %n = $input(Enter %s $+ : $+ %p IRC nickname. [Optional],eoidu,Enter)
  204.       var %d = $input(Enter %s $+ : $+ %p IRC ident. [Optional],eoidu,Enter)
  205.       var %g = $input(Enter %s $+ : $+ %p IRC gecos. [Optional],eoidu,Enter)
  206.  
  207.       irc %s %p %n %d %g
  208.     }
  209.   }
  210.  
  211.   $iif(!$sock($remove($menu,@)),$style(2)) Disconnect: {
  212.     var %ask = $input(Do you wanna terminate that session?,ywdh,Question)
  213.  
  214.     if (!%ask) { return }
  215.  
  216.     sockclose $remove($menu,@)
  217.  
  218.     echo $menu $irc_debug_linesep
  219.  
  220.     echo -tc info2 $menu Connection terminated.
  221.  
  222.     echo $menu $irc_debug_linesep
  223.   }
  224.   -
  225.   Close: {
  226.     var %ask = $input(Do you wanna close that session?,ywdh,Question)
  227.  
  228.     if (!%ask) { return }
  229.  
  230.     sockclose $remove($menu,@)
  231.  
  232.     echo $menu $irc_debug_linesep
  233.  
  234.     echo -tc info2 $menu Connection terminated due session close.
  235.  
  236.     echo $menu $irc_debug_linesep
  237.  
  238.     .timer -o 1 1 window -c $menu
  239.   }
  240. }
  241.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement