home *** CD-ROM | disk | FTP | other *** search
/ Chip 2005 June / ccd0605.iso / Software / Freeware / Comunicatii / jIRCii / jerk.jar / resource / default.irc < prev    next >
Text File  |  2005-05-08  |  21KB  |  1,013 lines

  1. #
  2. # default.irc
  3. # ----
  4. # a basic jirc script, does some simple stuff.
  5. # realizing my *dream* of ircii colored in with a crayon.
  6. #
  7. # The theme is simple on purpose, and the colors are campy
  8. # on purpose.  
  9. #
  10. #
  11.  
  12. $DEBUG = 0; # set to 1 if you want to see numerics in the default
  13.             # numerci echo.
  14.  
  15. #
  16. # These are some color constants I put together, so I could quickly
  17. # change them, the shift+click stuff in jIRC is dependent on a color
  18. # being a custom color so right here all the custom colors I want to
  19. # use are binded to a scalar
  20. #
  21.  
  22. # color scheme
  23. #
  24. # \c17 -> Light Gray     -> general text and such
  25. # \c18 -> Blue           -> Quit, Part, Kick, Notify Signoff
  26. # \c19 -> Green          -> channel joins, notify Sign on, Nick change
  27. # \c20 -> Orange         -> CTCP requests / notices 
  28. # \c21 -> Teal           -> User text
  29. # \c22 -> Violet         -> My text, Action text
  30. # \c22 -> Purple         -> messages
  31. # \c23 -> Yellow         -> mode changes, topic changes
  32. # \c24 -> Brown          -> notices
  33. # \c25 -> odd tan color  -> timestamps
  34. # \c26 -> op color       
  35. # \c27 -> voice color    
  36. # \c28 -> halfop color
  37. # \c29 -> user color
  38. # \c30 -> red            -> ctcp color
  39. # \c31 -> green          -> dcc chat color
  40. # \c32 -> black          -> statusbar color
  41. # \c33 -> grey           -> server reply neutral color
  42. # \c34 -> purple         -> send/receive messages
  43. # \c35 -> light red      -> server reply nick/user@host stuff
  44. # \c36 -> orange         -> server reply channels/hosts
  45. # \c37 -> red            -> error replies like server error
  46. # \c39 ->                -> ident request
  47. # \c40 ->                -> misc colors (url opening and such)
  48. # \c41 ->                -> dcc closed/done messages
  49. # \c42 ->                -> dcc open/status messages
  50.  
  51. $nnn = "*\B*\B*"; # the bullet used in all of our echo's
  52.  
  53. sub rehashWindow
  54. {
  55.    if (-iswindow $1)
  56.    {
  57.       local('$mmode');
  58.  
  59.       if ("l" ismode $1)
  60.       {
  61.          $mmode = getMode($1) . " " . getLimit($1);
  62.       }
  63.       else
  64.       {
  65.          $mmode = getMode($1);
  66.       }
  67.  
  68.       &setWindowTitle($1, "$1 [ $+ $mmode $+ ] " . strip(getTopic($1)));
  69.    }
  70. }
  71.  
  72. set CHANNEL_MODE_IS!
  73. {
  74.    return "\C17*\B*\B* Mode for\B $0 $+ \B\R:\R $parms"; 
  75. }
  76.  
  77. set CHANNEL_TOPIC_IS!
  78.    return "\C17*\B*\B* Topic for\B $0 $+ \B\R:\R $parms"; 
  79. }
  80. set CHANNEL_TOPIC_SETBY!
  81.    return "\C17 $+ *\B*\B* Topic for $1 set by $nick on $seton"; 
  82. }
  83.  
  84. set NICKLIST_FORMAT
  85. {
  86.    return formatNick($nick, $channel, $nick);
  87. }
  88.  
  89. sub formatNick
  90. {
  91.    if ($1 isop $2) 
  92.    {
  93.       return "\C26@\C29 $+ $3";
  94.    }
  95.    else if ($1 isvoice $2) 
  96.    {
  97.       return "\C27+\C29 $+ $3";
  98.    }
  99.    else if ($1 ishalfop $2)
  100.    {
  101.       return "\C28%\C29 $+ $3";
  102.    }
  103.    else if ($1 hasmode $2)
  104.    {
  105.       return "\C26\B" . getModeFor($1, $2) . "\B\C29 $+ $3";
  106.    }
  107.    return "\C29 $+ $3";
  108. }
  109.  
  110. set CHANNEL_CREATED!
  111.    return "\C17*\B*\B* Channel $1 was created on $created";
  112. }
  113.  
  114. on topic
  115. {
  116.    rehashWindow($1);
  117. }
  118.  
  119. on mode
  120. {
  121.    if ($me ison $target)
  122.    {
  123.       refreshWindow($target);
  124.    } 
  125. }
  126.  
  127. on open
  128. {
  129.    if ($me ison $window)
  130.    {
  131.       rehashWindow($window);
  132.    }
  133. }
  134.  
  135. on repl_324
  136. {
  137.    rehashWindow($1);
  138. }
  139.  
  140. set JOIN_SYNC!
  141. {
  142.    return "\C17*\B*\B* Join to\B $1 \Bwas synched in\B $sync \Bsecs."; 
  143. }
  144.  
  145. set CHANNEL_MODE 
  146.    rehashWindow($target);
  147.    return "\C23*\B*\B*\B $source \Bhas set mode\B $target $+ \B: $parms"; 
  148. }
  149.  
  150. set USER_MODE 
  151.    return "\C23*\B*\B*\B $source \Bhas set mode\B $target $+ \B: $parms"; 
  152. }
  153.  
  154. set CHANNEL_JOIN 
  155.    return "\C19*\B*\B*\B $nick \Bhas joined:\B $target"; 
  156. }
  157.  
  158. set CHANNEL_KICK 
  159.    return "\C18*\B*\B*\B $1 \Bhas been kicked by $nick $+ :\B $2-"; 
  160. }
  161.  
  162. set USER_QUIT 
  163.    return "\C18*\B*\B* Signoff:\B $nick \B(\B $+ $parms $+ \B)"; 
  164. }
  165.  
  166. set CHANNEL_PART 
  167.    return "\C18*\B*\B* $nick has left: $target"; 
  168. }
  169.  
  170. set CHANNEL_TEXT 
  171.    if ($me isin $parms) 
  172.    {
  173.       return "\C21<\B\U $+ $nick $+ \U\B>\C17 $parms";
  174.    }
  175.    return "\C21<\B $+ $nick $+ \B>\C17 $parms";
  176. }
  177.  
  178. set CHANNEL_TEXT_INACTIVE 
  179.    return "\C21<\b $+ $nick $+ \b\R:\R $+ $target $+ >\C17 $parms"; 
  180. }
  181.  
  182. set SEND_TEXT 
  183.    return "\C22<\B $+ $me $+ \B>\C17 $parms"; 
  184. }
  185.  
  186.  
  187. set SEND_TEXT_INACTIVE 
  188.    return "\C22<\B $+ $me $+ \B\R:\R $+ $target $+ >\C17 $parms"; 
  189. }
  190.  
  191. set USER_NICK 
  192. {
  193.    return "\C19*\B*\B* $nick is now known as:\B $1";
  194. }
  195.  
  196. set CHANNEL_TOPIC_CHANGED 
  197.    rehashWindow($0);
  198.    return "\C23*** $nick has changed the topic to:\B $parms"; 
  199. }
  200.  
  201. set ACTION 
  202.    return "\C22\B*\B $nick $1-"; 
  203. }
  204.  
  205. set PRIVACTION 
  206.    return "\C22\B*\B> $nick $1-"; 
  207. }
  208.  
  209.  
  210. set ACTION_INACTIVE 
  211. {
  212.    return "\C22* $nick $+ \R:\R $+ $0 $1-";
  213. }
  214.  
  215. set SEND_ACTION 
  216.    return "\C22*\B $me \B $+ $parms";
  217. }
  218.  
  219. set SEND_ACTION_INACTIVE 
  220.    return "\C22*\B $me $+ \B: $+ $0 $parms"; 
  221. }
  222.  
  223. set SEND_ACTION_PRIV 
  224. {
  225.    return "\C22*\B $me \B: $+ $0 $parms"; 
  226. }
  227.  
  228. set REPL_324!
  229. {
  230.    return;
  231. }
  232.  
  233. set REPL_372! 
  234.    return "\C17 $+ $parms";
  235. }
  236.  
  237. set FORMATTED_NAMES_HEADER!
  238. {
  239.    return "\C17*\B*\B* Users on\R:\R\B $2";
  240. }
  241.  
  242. set FORMATTED_NAMES
  243. {
  244.    if ($nick isnormal $2)
  245.    {
  246.       return " " . formatNick($nick, $2, left("$[12]nick", 12));
  247.    }
  248.    return formatNick($nick, $2, left("$[12]nick", 12));
  249. }
  250.  
  251. set TIMESTAMP 
  252.    return "\C25[\B $+ $time $+ \B] "; 
  253. }
  254.  
  255. set CTCP_REPLY 
  256.    $stuff = $2-;
  257.  
  258.    if ($pt ne "")
  259.    {
  260.      $stuff = $pt;
  261.    }
  262.  
  263.    return "\C30[ $+ $nick \B $+ $1 $+ \B reply]\R:\R $stuff";
  264. }
  265.  
  266. set SEND_DCC
  267. {
  268.    if ($1 eq "SEND")
  269.    {
  270.       return "\c42$nnn DCC SEND to $0 $+ \r:\r " . getFileName($4-) . " (" . formatBytes($3) . ")";
  271.    }
  272.  
  273.    return "\c42$nnn DCC " . uc($1) .  " to $0";
  274. }
  275.  
  276.  
  277. set SEND_CTCP 
  278. {
  279.    if ($1 eq "PING")
  280.    {
  281.       return "\C30\r->\r [ $+ $0 \BPING\B]";
  282.    }
  283.    else if ($2- eq "")
  284.    {
  285.       return "\C30\r->\r [ $+ $0 \B $+ $1 $+ \B]";
  286.    } 
  287.    else
  288.    {
  289.       return "\C30\r->\r [ $+ $0 \B $+ $1 $+ \B]\R:\R $2-";
  290.    }
  291. }
  292.  
  293. set SEND_NOTICE 
  294. {
  295.    return "\c24 $+ -> -\b $+ $0 $+ \b- $+ \c17 $parms";
  296. }
  297.  
  298. set SEND_WALL
  299. {
  300.    return "\c24\r[\rwall\r/\r\b $+ $0 $+ \b\r]:\r\c17 $1-";
  301. }
  302.  
  303. set SEND_WALLEX
  304. {
  305.    return "\c24\r[\rwall-x\r/\r\b $+ $0 $+ \b\r]:\r\c17 $1-";
  306. }
  307.  
  308. set NOTICE 
  309. {
  310.    if ($nick eq "")
  311.    {
  312.       return "\c24 $+ $parms";
  313.    }
  314.  
  315.    return "\c24 $+ -\b $+ $nick $+ \b-\c17 $parms";
  316. }
  317.  
  318. set PRIVMSG 
  319. {
  320.    return "\C34 $+ *\B $+ $nick $+ \B*\C17 $parms";
  321. }
  322. set SEND_MSG 
  323. {
  324.    if (-iswindow $target)
  325.    {
  326.        return "\C34*\B $+ $me $+ \B*\C17 $parms";
  327.    }
  328.    else
  329.    {
  330.        return "\C34 $+ \R->\R *\B $+ $target $+ \B*\C17 $parms";
  331.    }
  332. }
  333. set NOTIFY_SIGNON
  334. {
  335.    return "\C19 $+ $nnn Signon:\B $nick \B( $+ $address $+ )";
  336. }
  337. set NOTIFY_SIGNOFF 
  338. {
  339.    return "\C18 $+ $nnn Signoff:\B $nick \B( $+ $address $+ )";
  340. }
  341.  
  342. set REPL_366 { return; } # hide REPL_END_OF_NAMES
  343.  
  344. #
  345. # Whois Reply
  346. #
  347. set REPL_401 { return "\c33$nnn \c35\b $+ $1 $+ \b\c33 $2-"; } # no such nick/channel
  348. set REPL_406 { return "\c33$nnn \c35\b $+ $1 $+ \b\c33 $2-"; } # was no such nick/channel
  349. set REPL_301! { return formatWhois("Away", "$2-"); }
  350. set REPL_307! { return formatWhois("Register", "\c35\b $+ $1 $+ \b\c33 $2-"); }
  351. set REPL_311! { return formatWhois("Whois", "\c35\b $+ $1 \b\r[\r $+ $2 $+ \r@\r $+ $3 $+ \r]\c33:\r $5-"); }
  352. set REPL_312! { return formatWhois("Server", "\c36 $+ $2 \c33\r(\r $+ $3- $+ \r)\r"); }
  353. set REPL_313! { return formatWhois("Ircop", "\c35\b $+ $1 \b\c33 $+ $2-"); }
  354. set REPL_314! { return formatWhois("Who Was", "\c35\b $+ $1 \b\r[\r $+ $2 $+ \r@\r $+ $3 $+ \r]\c33:\r $5-"); }
  355. set REPL_317! { return formatWhois("Idle", formatTime($2)); }
  356. set REPL_330! { return formatWhois("Register", "\c33 $+ $1 $3- \c35\b $+ $2"); }
  357. set REPL_318  { return ""; } # hide END of /WHOIS 
  358. set REPL_369  { return ""; } # hide END of /WHOWAS 
  359. set REPL_319! 
  360.    local('$chtemp');
  361.    foreach $var (split(" ", $2-))
  362.    {
  363.       if (strlen($var) > 0 && charAt($var, 0) ne "#" && charAt($var, 0) ne "&") 
  364.       {
  365.          $var = "\r" . charAt($var, 0) . "\r" . substr($var, 1, strlen($var));
  366.       }
  367.       $chtemp = "$chtemp $+ $var ";
  368.    }
  369.  
  370.    return formatWhois("Channels", "\c36 $+ $chtemp"); 
  371. }
  372. set REPL_320! { return formatWhois("Secure", "\c35\b $+ $1 $+ \b\c33 $2-"); }
  373. set REPL_338! { return formatWhois("Host", "$2"); }
  374.  
  375. sub formatWhois
  376. {
  377.    local('$temp');
  378.    $temp = "\b" . charAt("$[8]1", 0) . "\b" . substr("$[8]1", 1, strlen("$[8]1"));
  379.    return "\c33 $+ $temp $+ \r:\r $2";
  380. }
  381.  
  382. #
  383. # formatted numerics
  384. #
  385. set REPL_403 { return formatNumeric($1, $2-); } # no such channel
  386. set REPL_442 { return formatNumeric($1, $2-); } # you're not on that channel
  387. set REPL_473 { return formatNumeric($1, $2-); } # banned
  388. set REPL_474 { return formatNumeric($1, $2-); } # invite
  389. set REPL_475 { return formatNumeric($1, $2-); } # key
  390. set REPL_433 { return formatNumeric($1, $2-); } # nick in use
  391.  
  392. sub formatNumeric
  393. {
  394.    if (charAt($1, 0) eq "#")
  395.    {
  396.       return "\c33$nnn \c36\b $+ $1 $+ \b\c33 $2"; 
  397.    }
  398.    return "\c33$nnn \c35\b $+ $1 $+ \b\c33 $2";
  399. }
  400.  
  401. #
  402. # Formatted Server Output Type Stuff
  403. #
  404.  
  405. # /who reply
  406. set REPL_352! 
  407. {
  408.    return "\c36 $+ $1 \c35\b $+ $5 \b\r[\r $+ $2 $+ \r@\r $+ $3 $+ \r]\r\c33 on\c36 $4 $+ \c33\r:\r $8-";
  409. }
  410.  
  411. set REPL_315 { return; }
  412.  
  413. # /mode #channel +b reply
  414. $_bancount = 0;
  415.  
  416. set CHANNEL_BANLIST
  417. {
  418.    local('@info');
  419.    @info = split('!', $3);
  420.  
  421.    $_bancount++;
  422.  
  423.    return "\c36 $+ $1 \c35\b $+ $2 \b\c33set by\r:\r\c35 " . @info[0];
  424. }
  425.  
  426. set CHANNEL_BANLIST_END
  427.    if ($_bancount == 0)
  428.    {
  429.       return "\c36 $+ $1 \c35\bno\b bans set";
  430.    }
  431.  
  432.    $_bancount = 0;
  433.    return; 
  434. }  # hide end of banlist reply...
  435.  
  436. # /links reply
  437. set REPL_364! 
  438. {
  439.    return "\C36 $+ $[20]1 \c33-\b>\b\c36 $[20]2 \c33\r(\r\b $+ $3 \bhops\r):\r $4-";
  440. }
  441.  
  442. set REPL_365 { return; }
  443.  
  444. # /list reply
  445. set REPL_321! 
  446. {
  447.    return "\c33\bC\bhannel              \bU\bsers   \bT\bopic";
  448. }
  449.  
  450. set REPL_322! 
  451. {
  452.    return "\c35\b $+ $[20]1 $+ \b\c33 $[-5]2   $3-";
  453. }
  454.  
  455. set REPL_323 { return; }
  456.  
  457. set NUMERIC! 
  458. #   return "\C17$nnn \r(\r\b $+ $numeric $+ \b\r)\r $parms"; 
  459.    return "\C17$nnn $parms"; 
  460. }
  461.  
  462. set CTCP_REQUEST 
  463. {
  464.    if ($2- eq ""  || ($1 eq "PING" && -isnumber $2) )
  465.    {
  466.       return "\C30[ $+ $nick \B $+ $1 $+ \B]";
  467.    }
  468.    else
  469.    {
  470.       return "\C30[ $+ $nick \B $+ $1 $+ \B]\R:\R $2-";
  471.    }
  472. }
  473.  
  474. set SBAR_LEFT 
  475. {
  476.   if ($me isop $query) 
  477.   {
  478.      $ime = "\B@\B $+ $me";
  479.   }
  480.   else if ($me ishalfop $query) 
  481.   {
  482.      $ime = "\B%\B $+ $me";
  483.   }
  484.   else if ($me isvoice $query) 
  485.   {
  486.      $ime = "\B+\B $+ $me";
  487.   }
  488.   else
  489.   {
  490.      $ime = "$me";
  491.   }
  492.  
  493.   if ($me ison $query)
  494.   {
  495.      $ichan = "on $query";
  496.   }
  497.   else
  498.   {
  499.      $ichan = "Query\R:\R $query";
  500.   }
  501.  
  502.   return "\c32 $+ [Lag:\B $lag $+ \B] $time $ime $ichan";
  503. }
  504.  
  505. sub getDCCPercentage
  506. {
  507.   if (getConnectionType($1) eq "RECEIVE")
  508.   {
  509.      return int((double(getBytesReceived($1)) / double(getExpectedSize($1))) * 100);
  510.   }
  511.  
  512.   if (getConnectionType($1) eq "SEND")
  513.   {
  514.      return int((double(getBytesSent($1)) / double(lof(getDCCFilePath($1)))) * 100);
  515.   }
  516. }
  517.  
  518. sub getDCCSizeSoFar
  519. {
  520.   if (getConnectionType($1) eq "RECEIVE")
  521.   {
  522.      return getBytesReceived($1);
  523.   }
  524.  
  525.   if (getConnectionType($1) eq "SEND")
  526.   {
  527.      return getBytesSent($1);
  528.   }
  529. }
  530.  
  531. set SBAR_RIGHT
  532. {
  533.   if (size(getActiveConnections()) > 0)
  534.   {
  535.      foreach $var (getActiveConnections())
  536.      {
  537.         if (getConnectionType($var) eq "RECEIVE")
  538.         {
  539.            $pc = getDCCPercentage($var);
  540.  
  541.            if ($DCC_WATCH_TIMER eq "")
  542.            {
  543.               sub timertemp
  544.               {
  545.                  refreshWindow(getActiveWindow());
  546.               }
  547.               $DCC_WATCH_TIMER = addTimer(&timertemp, 2000);
  548.            }
  549.  
  550.            return "\c32\r[\r" . left(getDCCFileName($var), 25) . "\r:\r $+ $pc $+ %\r]\r";
  551.         } 
  552.      }
  553.   }  
  554.  
  555.   if ($DCC_WATCH_TIMER ne "")
  556.   {
  557.      stopTimer($DCC_WATCH_TIMER);
  558.      $DCC_WATCH_TIMER = "";
  559.   }
  560.  
  561.   if (!-isSetT "ui.showtabs" && isServerConnected())
  562.   {
  563.      return "\c32\r[\r".getServerHost()."\r:\r".(getSessionId() + 1)."\r]";
  564.   }
  565.  
  566.   return "\c32\Rj\RIRC\Bii\B";
  567. }
  568.  
  569. set ON_CHANNELS 
  570. {
  571.   return "$nnn Channels: $parms";
  572. }
  573.  
  574. set SET_IGNORE
  575. {
  576.    if ($0 eq "add") { return "\c40 $+ $nnn Added\b $parms \bto ignore list"; }
  577.    if ($0 eq "remove") { return "\c40 $+ $nnn Removed\b $parms \bfrom ignore list"; }
  578. }
  579.  
  580. set SET_NOTIFY
  581. {
  582.    if ($0 eq "add") { return "\c40 $+ $nnn Added\b $parms \bto notify list"; }
  583.    if ($0 eq "remove") { return "\c40 $+ $nnn Removed\b $parms \bfrom notify list"; }
  584. }
  585.  
  586. set PROCESS_DATA! 
  587. {
  588.   return "[0] $parms";
  589. }
  590.  
  591.  
  592. #
  593. # DCC Chat Related
  594. #
  595.  
  596. set DCC_REQUEST 
  597. {
  598.    if ($2 eq "SEND")
  599.    {
  600.       return "\c42$nnn DCC SEND request from $nick $+ \r:\r $3 (" . formatBytes($6) . ")";
  601.    }
  602.  
  603.    return "\c42$nnn DCC $2 request from $nick";
  604. }
  605.  
  606. set CHATMSG
  607. {
  608.    return "\c31=\b $+ $0 $+ \b=\c17 $1-";
  609. }
  610.  
  611. set SEND_CHAT_ERROR
  612. {
  613.    return "\c41$nnn there is no open chat with $0";
  614. }
  615.  
  616. set SEND_CHAT
  617. {
  618.    if (-iswindow ("=" . $0))
  619.    {
  620.       return "\c31=\b $+ $me $+ \b=\c17 $1-";
  621.    }
  622.    else
  623.    {
  624.       return "\c31-> =\b $+ $0 $+ \b=\c17 $1-";
  625.    }
  626. }
  627.  
  628. set CHAT_OPEN
  629. {
  630.    return "\c42$nnn Chat with\b $nick \bopened.";
  631. }
  632.  
  633. set CHAT_CLOSE
  634. {
  635.    
  636.    return "\c41$nnn Chat with\b $nick \blost\b\r:\r $1-";
  637. }
  638.  
  639. #
  640. # /dcc command...  don't want anyone feeling to left out :)
  641. #
  642.  
  643. alias dcc
  644. {
  645.    if ($1 ne "")
  646.    {
  647.       call("/ $+ $0-", "use-built-in-command-only");
  648.       return;
  649.    }
  650.  
  651.    echo("\c17\bT\bype     \bN\bick        \bI\bnformation");
  652.  
  653.    foreach $conn (getActiveConnections())
  654.    {
  655.       $type = getConnectionType($conn);
  656.       $nick = getDCCNickname($conn);
  657.  
  658.       $info = DCCInformation($conn);
  659.  
  660.       echo("\c36$[7]type  \c35$[10]nick  $info");
  661.    }
  662. }
  663.  
  664. set DCC_LIST_TYPE
  665. {
  666.    $conn = getDCCConnection($this);
  667.    return "\c36" . getConnectionType($conn);
  668. }
  669.  
  670. set DCC_LIST_NICK
  671. {
  672.    $conn = getDCCConnection($this);
  673.    return "\c35" . getDCCNickname($conn);
  674. }
  675.  
  676. sub DCCInformation
  677. {
  678.    local('$info $conn');
  679.  
  680.    $conn = $1;
  681.    $type = getConnectionType($conn);
  682.  
  683.    if (!-isdccopen $conn)
  684.    {
  685.      return "Waiting...";
  686.    }
  687.  
  688.    if ($type eq "CHAT")
  689.    {
  690.      $info = "\c33\bI\bdle\r:\r " . formatTime(getDCCIdleTime($conn) / 1000);
  691.    }
  692.    else
  693.    {
  694.      $info = "\r(\r\bE\bst\r:\r " . formatTime2(getTimeRemaining($conn)) . "\r)\r";
  695.           
  696.      local('$a $b $c $d');
  697.      $a = getDCCPercentage($conn);
  698.      $b = getDCCFileName($conn);
  699.      $c = formatBytes(getTransferRate($conn)) . "/s";
  700.      $d = "\r(\r\bS\bize\r:\r " . formatBytes(getDCCSizeSoFar($conn)) . "\r)\r";
  701.  
  702.      $info = "\c33 $+ $[21]info $+ $[-2]a $+ \r%\r $[7]c $+ $[22]d $+ $b"
  703.    }
  704.  
  705.    return $info;
  706. }
  707.  
  708. set DCC_LIST_INFORMATION
  709. {
  710.    return DCCInformation(getDCCConnection($this));
  711. }
  712.  
  713. #
  714. #
  715. set RECEIVE_COMPLETE
  716. {
  717.    $dcc  = getDCCConnection($this);
  718.    $file = getDCCFileName($dcc);
  719.    $rate = formatBytes(getTransferRate($dcc)) . "/s";
  720.    return "\c41$nnn Receive of $file from $nick complete at $rate";
  721. }
  722.  
  723. set SEND_COMPLETE
  724. {
  725.    return "\c41$nnn Send to $nick complete";
  726. }
  727.  
  728. set RECEIVE_START
  729. {
  730.    $dcc  = getDCCConnection($this);
  731.    $file = getDCCFileName($dcc);
  732.    return "\c42$nnn Receive of $file from $nick has started";
  733. }
  734.  
  735. set SEND_START
  736. {
  737.    printf("Start of send to $nick");
  738.    return "\c42$nnn Send to $nick has started";
  739. }
  740.  
  741. set RECEIVE_FAILED
  742. {
  743.    return "\c41$nnn Receive from $nick has failed: $1-";
  744. }
  745.  
  746. set SEND_FAILED
  747. {
  748.    return "\c41$nnn Send to $nick has failed: $1-";
  749. }
  750.  
  751. #
  752. # Normal DCC Messages..  always fun
  753. #
  754. set RESUME_SUCCEEDED
  755. {
  756.    return "\c42$nnn Resume request to $nick successful";
  757. }
  758.  
  759. set RESUME_FAILED
  760. {
  761.    return "\c41$nnn Resume request to $nick \bfailed\b";
  762. }
  763.  
  764. set RESUME_REQUEST_ERROR
  765. {
  766.    return "\c41$nnn $nick has made a jacked up resume request";
  767. }
  768.  
  769. set RESUME_REQUEST
  770. {
  771.    return "\c42$nnn $nick has requested to resume the dcc transfer";
  772. }
  773.  
  774. set RESOLVED_LOCALINFO
  775. {
  776.     return "\C42*\B*\B* Resolved local host to\B $0";
  777. }
  778.  
  779. # /dns reply
  780. set RESOLVED_HOST
  781. {
  782.     if ($2- ne "")
  783.     {
  784.        return "\C42*\B*\B* Resolved\b $0 \bto $2 $+ \r[\r $+ $1 $+ \r]\r";
  785.     }
  786.     else
  787.     {
  788.        return "\C42*\B*\B* Unable to resolve $0 $+ \r:\r host not found";
  789.     }
  790. }
  791.  
  792. #
  793. # aliases
  794. #
  795. alias notify
  796. {
  797.    if ($1 ne "")
  798.    {
  799.       call("/ $+ $0-", "use-built-in-command-only");
  800.       return;
  801.    }
  802.  
  803.    echo("\c17$nnn Signed on\r:");
  804.    
  805.    $output = "";
  806.  
  807.    foreach $var (getSignedOnUsers())
  808.    {
  809.       $otime   = onlineFor($var);
  810.  
  811.       if ($otime < 300)                # users signed on within the past 5 minutes
  812.       {
  813.          $output = "$output \b $+ $var $+ \b";
  814.       }
  815.       else if ($otime < (60 * 60))     # users signed on for up to an hour
  816.       {
  817.          $output = "$output $var";
  818.       }
  819.       else                             # anything over an hour
  820.       {
  821.          $output = "$output \r $+ $var $+ \r";
  822.       }
  823.    }
  824.  
  825.    echo("\c17  $output");
  826.  
  827.    echo("\c17$nnn Signed off\r:");
  828.    
  829.    $output = "";
  830.  
  831.    foreach $var (getSignedOffUsers())
  832.    {
  833.       $output = "$output $var";
  834.    }
  835.   
  836.    echo("\c17  $output");
  837. }
  838.  
  839. set IDENT_REQUEST
  840. {
  841.    return "\c39$nnn Ident request from $0";
  842. }
  843.  
  844. set SERVER_ERROR
  845. {
  846.    return "\c37$nnn Server error: $parms";
  847. }
  848.  
  849. set IRC_ATTEMPT_CONNECT
  850. {
  851.    return "\c19$nnn Attempting to connect to " . $0;
  852. }
  853.  
  854. set IRC_DISCONNECT
  855. {
  856.    return "\c18$nnn Disconnected from\b " . getServerHost() . "\b\r:\r $parms";
  857. }
  858.  
  859. set IRC_CONNECT
  860. {
  861.    return "\c19\r$nnn Connected to\r\b " . getServerHost() . "\b";
  862. }
  863.  
  864. set IRC_RECONNECT
  865. {
  866.    return "\c19\r$nnn Attempting to reconnect to\r\b " . getServerHost() . "\b";
  867. }
  868.  
  869. set INVITE
  870. {
  871.    return "\c24$nnn \b $+ $nick $+ \b invites you to join\r:\r $1";
  872. }
  873.  
  874. set REPL_341
  875. {
  876.    return "\c33$nnn $1 has been invited to\r:\r\c36 $2";
  877. }
  878.  
  879. #
  880. # Completes the current nickname in the editbox..
  881. #
  882. $_TAB_TEXT    = "";
  883. @_TAB_NICKS   = array();
  884. $_TAB_LAST    = "";
  885.  
  886. sub setTabInput
  887. {
  888.    $_TAB_TEXT = "$1 $+ $2";
  889.    $_TAB_LAST = $2;
  890.    setInputText(getActiveWindow(), $_TAB_TEXT);
  891. }
  892.  
  893. bind tab
  894. {
  895.    local('$text @data $pnick');
  896.  
  897.    $text  = getInputText(getActiveWindow());
  898.    
  899.    if (-ischannel $active && $text eq "/topic")
  900.    {
  901.       setTabInput("/topic $active " . getTopic($active));
  902.    }
  903.    else if ($_TAB_TEXT eq $text && size(@_TAB_NICKS) > 0)
  904.    {
  905.       if (left($text, 1) eq "/" && indexOf($text, " ") == -1)
  906.       {
  907.          setTabInput("/", shift(@_TAB_NICKS));
  908.       }
  909.       else 
  910.       {
  911.          $text  = substr($text, 0, strlen($text) - strlen($_TAB_LAST));
  912.          setTabInput("$text", shift(@_TAB_NICKS));
  913.       }
  914.    }
  915.    else if (left($text, 1) eq "/" && indexOf($text, " ") == -1)
  916.    {
  917.       $text       = substr($text, 1);
  918.       @_TAB_NICKS = array();
  919.      
  920.       foreach $var (getAliasList())
  921.       {
  922.          $var = lc($var);
  923.  
  924.          if (left($var, strlen($text)) eq $text)
  925.          {
  926.             add(@_TAB_NICKS, $var, 0);
  927.          }
  928.          else if ($text isin $var)
  929.          {
  930.             push(@_TAB_NICKS, $var);
  931.          }
  932.       }
  933.  
  934.       push(@_TAB_NICKS, $text);
  935.       setTabInput("/", shift(@_TAB_NICKS));
  936.    }
  937.    else if ($text ismatch '/dcc send \S+ (.+)' || 
  938.             $text ismatch '/send \S+ (.+)' || 
  939.             $text ismatch '/load (.+)' || 
  940.             $text ismatch '/theme (.+)' || 
  941.             $text ismatch '/xdcc offer (.+)' || 
  942.             $_IS_FILE_COMPLETE == 1)
  943.    {
  944.       @data  = matched();
  945.       $pnick = pop(@data);
  946.       $text  = substr($text, 0, strlen($text) - strlen($pnick));
  947.  
  948.       @_TAB_NICKS = fileCompleteAll($pnick);
  949.  
  950.       setTabInput("$text", shift(@_TAB_NICKS));
  951.    }
  952.    else if (-ischannel $active && strlen($text) > 0 && right($text, 1) ne " ")
  953.    {
  954.       @data  = split(' ', $text);
  955.       $pnick = pop(@data);
  956.       $text  = substr($text, 0, strlen($text) - strlen($pnick));
  957.  
  958.       if ($pnick eq "#")
  959.       {
  960.          @_TAB_NICKS = array();
  961.          setTabInput("$text $+ $active", "");
  962.       }
  963.       else if (left($pnick, 1) eq "/")
  964.       {
  965.          # do nothing...  we don't want to nick complete a "command"
  966.       }
  967.       else
  968.       {
  969.          @_TAB_NICKS = nickCompleteAll($pnick, $active);
  970.          setTabInput("$text", shift(@_TAB_NICKS));
  971.       }
  972.    }
  973.    else if ($_LAST_MESSAGE)
  974.    {
  975.       @_TAB_NICKS = array();
  976.       setInputText(getActiveWindow(), "/msg $_LAST_MESSAGE ");
  977.    }
  978. }
  979.  
  980. on msg
  981. {
  982.    $_LAST_MESSAGE = $nick;
  983. }
  984.  
  985.  
  986.  
  987.  
  988.