home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / icbrg200.zip / IBERGCMD.CMD < prev    next >
OS/2 REXX Batch file  |  1996-02-25  |  29KB  |  877 lines

  1. /*********************************************************************/
  2. /* IceBerg IRC REXX Command Script for GTirc.  V 2.00  25 Feb 1996   */
  3. /*                  Copyright 1996 - Stephen Berg                    */
  4. /*********************************************************************/
  5. /* This file sets up all the commands that I have created, or stolen */
  6. /* from other scripts and changed to work with REXX.  It works in    */
  7. /* conjunction with the IBERGMSG.CMD script to customize your IRC    */
  8. /* client, add functionality and bring GTirc to a point where it more*/
  9. /* than competes with any other IRC client out there for OS/2.       */
  10. /*********************************************************************/
  11. /* This pair of REXX scripts and the ICESTART.TXT startup file are   */
  12. /* my creation and I retain all copyrights to the files.  They are   */
  13. /* however freely distributable, but I do ask that you email if you  */
  14. /* are using them.  sberg@southwind.com                              */
  15. /*********************************************************************/
  16.  
  17. Parse Upper Arg Win Us Verb Parm1 Parms
  18. Parse Arg xWin xUs xVerb xParm1 xParms
  19. Parse Arg yWin yUs yVerb yParm1 yParm2 yParms
  20.  
  21. Pool = 'OS2ENVIRONMENT'
  22.  
  23. ErStr1 = '+++ Syntax +++++'
  24. ErStr2 = '++++ Error +++++'
  25. ErStr3 = '++++++++++++++++'
  26. titlline = '+------------------------IceBerg V 2.00------------------------+'
  27.  
  28. /*********************************************************************/
  29. /* We implement an /iceberg command to set and check global rexx     */
  30. /* variables for the scripts to examine for various purposes.        */
  31. /*********************************************************************/
  32.  
  33. if (Verb = '/ICEBERG') then do
  34.      if (Parm1 <> '') then do
  35.         if (Parms <> '') then do
  36.             VALUE(Parm1,Parms,Pool)
  37.             ircrexxdisplay(Parm1 'Set to: ' || Parms || '.', win)
  38.             Return ''
  39.         end
  40.         else do
  41.             TempStr = Value(Parm1,,Pool)
  42.             IrcRexxDisplay(Parm1 'Is currently: ' || TempStr || '.', win)
  43.             Return ''
  44.         end
  45.     end
  46.     else do
  47.         IrcRexxDisplay("Once I figure out a way to get and display all",Win)
  48.         IrcRexxDisplay("the defined variables in the Pool.  I'll add",Win)
  49.         IrcRexxDisplay("it in here.",Win)
  50.         Return ''
  51.     end
  52. end
  53.  
  54. /*********************************************************************/
  55. /* The /WHOM command simply executes a /VERSION and /USERINFO on the */
  56. /* specified nickname.                                               */
  57. /*                            Syntax:  /WHOM nickname                */
  58. /*********************************************************************/
  59.  
  60. if (Verb = '/WHOM') then do
  61.    if (Parm1 <> '') then do
  62.       OutStr = "/VERSION "  Parm1
  63.       IrcRexxCommand(OutStr,Win)
  64.       OutStr = "/USERINFO " Parm1
  65.       IrcRexxCommand(OutStr,Win)
  66.    end
  67.  
  68.    else do
  69.       IrcRexxDisplay(ErStr1 "You must provide a users nick that",Win)
  70.       IrcRexxDisplay(ErStr2 "you wish to get info about",Win)
  71.    end
  72.  
  73.    Return ""
  74. end
  75.  
  76. /*  Check a users idle time  */
  77.  
  78. if (Verb = '/IDLE') then do
  79.    if (Parm1 <> '') then do
  80.       OutStr = "/whois"  Parm1 Parm1
  81.       IrcRexxCommand(OutStr,Win)
  82.    end
  83.  
  84.    else do
  85.       IrcRexxDisplay(ErStr1 "You must provide a users nick that",Win)
  86.       IrcRexxDisplay(ErStr2 "you wish to get idle info about",Win)
  87.    end
  88.  
  89.    Return ""
  90. end
  91.  
  92.  
  93. /*********************************************************************/
  94. /* Help screens - on-line help for IceBerg                           */
  95. /*********************************************************************/
  96.  
  97. if (Verb = '/ICEHELP') then do
  98.     IrcRexxDisplay(titlline,Win)
  99.     IrcRexxDisplay("                 +------Icehelp Page One------+", Win)
  100.     IrcRexxDisplay('/iceberg <variable> [Value] - To set or view a variable',Win)
  101.     IrcRexxDisplay('/whom <nick> -                Get Version and Userinfo for nick',Win)
  102.     IrcRexxDisplay('/idle <nick> -                Get idle time for nick',Win)
  103.     IrcRexxDisplay('/icehelp -                    This help display',Win)
  104.     IrcRexxDisplay('/icehelp2 -                   Page 2 of the help display',Win)
  105.     IrcRexxDisplay('/icehelp3 -                   Page 3 of the help display',Win)
  106.     IrcRexxDisplay('/msghlp -                     Help display for the message logging functions',Win)
  107.     IrcRexxDisplay('/dw <hostname|IP address> -   /who on the hostname/IP address',Win)
  108.     IrcRexxDisplay('/wall <#channel> <text> -     /msg all channel occupants with text',Win)
  109.     IrcRexxDisplay('/wallop <#channel> <text> -   /msg all channel ops with text',Win)
  110.     IrcRexxDisplay('/xdccadv -                    advertise your available XDCC files to the',Win)
  111.     IrcRexxDisplay("                              current channel",Win)
  112.     IrcRexxDisplay('/cstat <#channel> -           Get statistics for #channel',Win)
  113.     IrcRexxDisplay('/crypt <text> -               Send text with encryption to current channel',Win)
  114.     IrcRexxDisplay('/revsay <text> -              Reverse text and send to channel',Win)
  115.     IrcRexxDisplay('/revmsg <nick> <text> -       Reverse text and msg to nick',Win)
  116.     IrcRexxDisplay('/revme <text> -               Reverse text and say as a /me',Win)
  117.     IrcRexxDisplay(titlline,Win)
  118. Return ''
  119. end
  120.  
  121. if (Verb = '/ICEHELP2') then do
  122.     IrcRexxDisplay(titlline,Win)
  123.     IrcRexxDisplay("                 +------Icehelp Page Two------+", Win)
  124.     IrcRexxDisplay('/nsl <hostname|IP adress> -   Do an OS/2 nslookup on <hostname> or <IP address>',Win)
  125.     IrcRexxDisplay('/host <hostname|IP adress> -  Run OS/2s host command',Win)
  126.     IrcRexxDisplay('/osping <hostname|IP adress>- Do an OS/2 ping on hostname or IP',Win)
  127.     IrcRexxDisplay('/ossend <command> -           Run an OS/2 command and send to the channel',Win)
  128.     IrcRexxDisplay('/osmsg <command> -            Run an OS/2 command and send as a msg to nick',Win)
  129.     IrcRexxDisplay('/exec <command> -             Run an OS/2 command',Win)
  130.     IrcRexxDisplay('/getservers -                 Get a new "servers.lst" listing',Win)
  131.     IrcRexxDisplay('/findsplit -                  Find any split servers (see IBreadme.txt)',Win)
  132.     IrcRexxDisplay('/addnew -                     Add any new servers found to "servers.lst"',Win)
  133.     IrcRexxDisplay('/calc <text> -                get a calc for <text> from OS2Bot on #os/2',Win)
  134.     IrcRexxDisplay('/phone <company name> -       get a phone # for <company name> from OS2Bot',Win)
  135.     IrcRexxDisplay("                              on #os/2 (EFNet)",Win)
  136.     IrcRexxDisplay(titlline,Win)
  137. Return ''
  138. end
  139.  
  140.    /* *** Normal IRC commands that I have shortened/enhanced *** */   
  141.  
  142. if (Verb = '/ICEHELP3') then do
  143.     IrcRexxDisplay(titlline,Win)
  144.     IrcRexxDisplay("                +------Icehelp Page Three------+", Win)
  145.     IrcRexxDisplay('/k <nick> -                   kicks nick from the current channel',Win)
  146.     IrcRexxDisplay('/kb <#channel> <nick> -       bans and then kicks nick from the current',Win)
  147.     IrcRexxDisplay("                              channel, a reason may be supplied.",Win)
  148.     IrcRexxDisplay('/j <#channel> -               /JOIN #channel',Win)
  149.     IrcRexxDisplay('/q <nick> -                   start a private query with <nick>',Win)
  150.     IrcRexxDisplay('/lv [#channel] -              Leave the current or specified channel',Win)
  151.     IrcRexxDisplay('/not <nick|#channel> <text> - /NOTICE the nick or channel with text',Win)
  152.     IrcRexxDisplay("/t [text] -                   Display the current channel's topic or",Win)
  153.     IrcRexxDisplay("                              change it to text",Win)
  154.     IrcRexxDisplay('/wi <nick> -                  /WHOIS on nick',Win)
  155.     IrcRexxDisplay('/ww <nick> -                  /WHOWAS on nick',Win)
  156.     IrcRexxDisplay('/inv <nick> -                 Invite nick to current channel',Win)
  157.     IrcRexxDisplay("/cm [[+|-] modes] -           Change current channel's mode setting",Win)
  158.     IrcRexxDisplay('/um [[+|-] modes] -           Change users mode setting',Win)
  159.     IrcRexxDisplay(titlline,Win)
  160. Return ''
  161. end
  162.         /* *** Message logging related commands *** */
  163.  
  164. if (Verb = '/MSGHELP') then do
  165.     IrcRexxDisplay(titlline,Win)
  166.     IrcRexxDisplay("                   +------Message Help------+", Win)
  167.     IrcRexxDisplay('/reset -                      Reset the message logger (Please Refer to readme.txt)',Win)
  168.     IrcRexxDisplay('/play -                       Displays the messages stored',Win)
  169.     IrcRexxDisplay('/playlong -                   Displays the messages stored with full ID of sender',Win)
  170.     IrcRexxDisplay('/msgchk -                     Display the current number of messages stored',Win)
  171.     IrcRexxDisplay('/gone [awaymsg] -             Turn on the message logger and set the away',Win)
  172.     IrcRexxDisplay('                              flag using the default awaymsg unless',Win)
  173.     IrcRexxDisplay('                              one is specified',Win)
  174.     IrcRexxDisplay('/back -                       Turn off the message logger, unset the away flag',Win)
  175.     IrcRexxDisplay('                              and display any messages saved',Win)
  176.     IrcRexxDisplay('/awaymsg <text> -             Change the default awaymsg (not permanent, use the ',Win)
  177.     IrcRexxDisplay('                              Startup Command and IceStart.txt file to make a',Win)
  178.     IrcRexxDisplay('                              permanent default awaymsg',Win)
  179.     IrcRexxDisplay(titlline,Win)
  180. Return ''
  181. end
  182.  
  183. /* Domain who  */
  184.  
  185. if (Verb = '/DW') then do
  186.      if (Parm1 <> '') then do
  187.     OutStr = "/who *" || xParm1 || "*"
  188.     IrcRexxCommand(OutStr,Win)
  189.      end
  190.  
  191.      else do
  192.       IrcRexxDisplay(ErStr1 'You must provide a domain that you',Win)
  193.       IrcRexxDisplay(ErStr2 'wish to get user info from',Win)
  194.      end
  195.  
  196.      Return ""
  197. end
  198.  
  199. /*********************************************************************/
  200. /* Wall (msg all channel members or ops) - Abuse this one and you'll */
  201. /*                    probably get a swift boot.                     */
  202. /*********************************************************************/
  203.  
  204. if (Verb = '/WALL') then do
  205.     if (Parm1 <> '') then do
  206.         Value('walling','ON',Pool)
  207.         Value('wallmsg',xParms,Pool)
  208.         IrcRexxSend("NAMES" xParm1,Win)
  209.         Return
  210.     end
  211.     else do
  212.         IrcRexxDisplay(erstr1 'You must provide a target channel to',Win)
  213.         IrcRexxDisplay(erstr2 'get all the nicks that you want to msg',Win)
  214.         IrcRexxDisplay(erstr3 'and the message to be sent',Win)
  215.         Return
  216.     end
  217.     Return
  218. end
  219.  
  220. /* Wall (msg all channel operators) - Abuse this  */
  221. /* one and you'll probably get a swift boot.      */
  222.  
  223. if (Verb = '/WALLOP') then do
  224.     if (Parm1 <> '') then do
  225.         Value('walloping','ON',Pool)
  226.         Value('wallmsg',xParms,Pool)
  227.         IrcRexxSend("NAMES" xParm1,Win)
  228.         Return
  229.     end
  230.     else do
  231.         IrcRexxDisplay(erstr1 'You must provide a target channel to',Win)
  232.         IrcRexxDisplay(erstr2 'get all the ops-nicks that you want to',Win)
  233.         IrcRexxDisplay(erstr3 'msg and the message to be sent',Win)
  234.         Return
  235.     end
  236. end
  237.  
  238. /*  Advertise files available via XDCC                               */
  239. if (Verb = '/XDCCADV') then do
  240.     FileList = "filelist.txt"
  241.     LineNo=0
  242.     IrcRexxCommand("/me XDCC File offerings:", Win)
  243.     do while Lines(FileList)
  244.         Fileline = LineIn(FileList)
  245.         if Fileline = "" then leave
  246.         LineNo = LineNo + 1
  247.         Parse Var Fileline Filename Filedesc
  248.         FileName2 = FileSpec("N",FileName)
  249.         FileSize = Stream(FileName,"C","QUERY SIZE")
  250.         IrcRexxCommand("/me " LineNo || ":" FileDesc "|" Filename2 "[" || FileSize || " bytes]", Win)
  251.     End
  252.     IrcRexxCommand("/me type: /msg" Us "Send #  where '#' is the file number.", WIn)
  253.     Return ""
  254. end
  255.  
  256. /*********************************************************************/
  257. /* Get and display statistics about a particular channel             */
  258. /*********************************************************************/
  259.  
  260. if (Verb = '/CSTAT') then do
  261.     if (Parm1 <> '') then do
  262.         Value('cstating','ON',Pool)
  263.         IrcRexxSend('NAMES' xParm1,Win)
  264.         IrcRexxSend('MODE' xParm1,Win)
  265.         IrcRexxSend('LIST' xParm1,Win)
  266.     end
  267.     else do
  268.         Value('cstating','OFF',Pool)
  269.         IrcRexxDisplay(ErStr1 "You must provide a channel that you wish",Win)
  270.         IrcRexxDisplay(ErStr2 "to retreive stats for.",Win)
  271.     end
  272.     Return ""
  273. end
  274.  
  275. /*********************************************************************/
  276. /*        Normal IRC commands shortened for ease of use             */
  277. /*********************************************************************/
  278.  
  279. if (Verb = '/K') then do
  280.     if (Parm1 <> '') then do
  281.         if (xParms <> '') then do
  282.             IrcRexxCommand('/kick' xParm1 xParms
  283.             Return ''
  284.         end
  285.         else do
  286.             IrcRexxCommand('/kick' xParm1 'IceBerg Kick!', Win)
  287.             Return ''
  288.         end
  289.     end
  290.     else do
  291.         IrcRexxDisplay(ErStr3 'You must specify a nick to be kicked', Win)
  292.         Return ''
  293.     end
  294. end
  295.  
  296. /*********************************************************************/
  297. /* Kick/Ban start routine, the rest is handled in ibergmsg.cmd       */
  298. /*********************************************************************/
  299.  
  300. if (Verb = '/KB') then do
  301.     if yParm1 <> '' then do
  302.         if yParm2 <> '' then do
  303.             Value('kbanning', 'ON', Pool)
  304.             Value('kbanchan', yParm1, Pool)
  305.             Parse Upper Var yParm2 Nick
  306.             Value('kbannick', Nick, Pool)
  307.             Value('kbanreason', yParms, Pool)
  308.             IrcRexxCommand('/userhost' yParm2, Win)
  309.             Return ''
  310.         end
  311.         else do
  312.             IrcRexxDisplay(erstr1 'You must provide a channel and a nick', Win)
  313.             IrcRexxDisplay(erstr2 'for the kick ban command', Win)
  314.             IrcRexxDisplay(erstr3 'A reason may be provided if you wish.', Win)
  315.             IrcRexxDisplay(erstr3 "eg:  /kb #os/2 os2bot I'm sick of your calcs!", Win)
  316.             Return ''
  317.         end
  318.     end
  319.     else do
  320.         IrcRexxDisplay(erstr1 'You must provide a channel and a nick', Win)
  321.         IrcRexxDisplay(erstr2 'for the kick ban command', Win)
  322.         IrcRexxDisplay(erstr3 'A reason may be provided if you wish.', Win)
  323.         IrcRexxDisplay(erstr3 "eg:  /kb #os/2 os2bot I'm sick of your calcs!", Win)
  324.         Return ''
  325.     end
  326. end
  327.  
  328. if (Verb = '/J') then do
  329.     if (Parm1 <> '') then do
  330.         IrcRexxCommand('/join' xParm1,Win)
  331.         Return ''
  332.     end
  333.     else do
  334.         IrcRexxDisplay(ErStr3 'You must specify a channel name with /j',Win)
  335.         Return ''
  336.     end
  337. end
  338.  
  339. if (Verb = '/Q') then do
  340.     if (Parm1 <> '') then do
  341.         IrcRexxCommand('/query' xParm1, Win)
  342.         Return ''
  343.     end
  344.     else do
  345.         IrcRexxDisplay(ErStr1 'You must specify a user that you wish to', Win)
  346.         IrcRexxDisplay(ErStr2 'start a private query with', Win)
  347.         Return ''
  348.     end
  349. end
  350.  
  351. if (Verb = '/LV') then do
  352.     if (Parm1 <> '') then do
  353.         IrcRexxCommand('/leave' Parm1,Win)
  354.         Return ''
  355.     end
  356.     else do
  357.         IrcRexxCommand('/leave',Win)
  358.         Return ''
  359.     end
  360. end
  361.  
  362. /* this makes up for an unsupported /NOTICE command in GTirc */
  363.  
  364. if (Verb = '/NOT') then do 
  365.     if (Parm1 <> '') then do
  366.         OutStr = "NOTICE" xParm1 ":" || xParms
  367.         IrcRexxSend(OutStr,Win)
  368.         IrcRexxDisplay("+" || xParm1 || "+" xParms, Win)
  369.     end
  370.     else do
  371.         IrcRexxDisplay(ErStr1, 'You must provide a nick or channel',Win)
  372.         IrcRexxDisplay(ErStr2, 'and some text to be sent to that',Win)
  373.         IrcRexxDisplay(ErStr3, 'nick or channel as a notice',Win)
  374.     end
  375.     Return ""
  376. end
  377.  
  378. if (Verb = '/T') then do
  379.     if (Parm1 <> '') then do
  380.         IrcRexxCommand('/topic' xParm1 xParms,Win)
  381.         Return ''
  382.     end
  383.     else do
  384.         IrcRexxCommand('/topic',Win)
  385.         Return ''
  386.     end
  387. end
  388.  
  389. if (Verb = '/WI') then do
  390.     if (Parm1 <> '') then do
  391.         IrcRexxCommand('/whois' xParm1,Win)
  392.         Return ''
  393.     end
  394.     else do
  395.         IrcRexxDisplay(ErStr3 'You must specify a nick with /wi',Win)
  396.         Return ''
  397.     end
  398. end
  399.  
  400. if (Verb = '/WW') then do
  401.     if (Parm1 <> '') then do
  402.         IrcRexxCommand('/whowas' xParm1,Win)
  403.         Return ''
  404.     end
  405.     else do
  406.         IrcRexxDisplay(ErStr3 'You must specify a nick with /ww',Win)
  407.         Return ''
  408.     end
  409. end
  410.  
  411. if (Verb = '/INV') then do
  412.     if (Parm1 <> '') then do
  413.         IrcRexxCommand('/invite' xParm1,Win)
  414.         Return ''
  415.     end
  416.     else do
  417.         IrcRexxDisplay(ErStr3 'You must specify a nick with with /inv',Win)
  418.         Return ''
  419.     end
  420. end
  421.  
  422. if (Verb = '/CM') then do
  423.     if (Parm1 <> '') then do
  424.         IrcRexxCommand('/mode *' xParm1 xParms,Win)
  425.         Return ''
  426.     end
  427.     else do
  428.         IrcRexxCommand('/mode *',Win)
  429.         Return ''
  430.     end
  431. end
  432.  
  433. if (Verb = '/UM') then do
  434.     if (Parm1 <> '') then do
  435.         IrcRexxCommand('/mode' Us xParm1,Win)
  436.         Return ''
  437.     end
  438.     else do
  439.         IrcRexxDisplay('A mode change must be specified with /um',Win)
  440.         Return ''
  441.     end
  442. end
  443.  
  444. /* End of short versions of normal commands  */
  445.  
  446.  
  447. /*********************************************************************/
  448. /*               Beginning of the message logger functions           */
  449. /*                  I got this code from Wease on EFNet              */
  450. /*********************************************************************/
  451.  
  452. /*    Simple command to reset my message queue   */
  453.  
  454. if (Verb = '/RESET') then do
  455. hdrline = '+------------------IceBerg V 2.00 Message Log------------------+'
  456.     IrcRexxCommand('/exec del messages.log', Win)
  457.     LineOut(messages.log, hdrline, 1)
  458.     LineOut(messages.log)
  459.     IrcRexxDisplay('Message log file reset', Win)
  460.    Return ""
  461. end
  462.  
  463. /* View the Message Queue */
  464.  
  465. if (Verb = '/PLAY') then do
  466. msglog = Value(msglog,,Pool)
  467. counter = 0
  468. hdrline = '+------------------IceBerg V 2.00 Message Log------------------+'
  469.     if (msglog \= 'ON') then ircrexxdisplay("Message Log DISABLED", Win)    
  470.     Do While Lines(messages.log)
  471.         message = LineIn(messages.log)
  472.         Parse Var message nick id msg
  473.         if nick = '+------------------IceBerg' then do
  474.             IrcRexxDisplay(hdrline, Win)
  475.         end
  476.         else do
  477.             counter = counter + 1
  478.             IrcRexxDisplay(counter || ':' '*' || nick || '*'  msg, Win)
  479.         end
  480.     end
  481.     ircrexxdisplay(titlline, win)
  482.     Return ""
  483. end
  484.  
  485. /* View the Message Queue with user@host info instead of just */
  486. /* Nick for the from address                                  */
  487.  
  488. if (Verb = '/PLAYLONG') then do
  489. msglog = Value(msglog,,Pool)
  490. counter = 0
  491. hdrline = '+------------------IceBerg V 2.00 Message Log------------------+'
  492.     if (msglog \= 'ON') then ircrexxdisplay("Message Log DISABLED", Win)    
  493.     Do While Lines(messages.log)
  494.         message = LineIn(messages.log)
  495.         Parse Var message nick id msg
  496.         if nick = '+------------------IceBerg' then do
  497.         IrcRexxDisplay(hdrline, Win)
  498.         end
  499.         else do
  500.             counter = counter + 1
  501.             IrcRexxDisplay(counter || ':' '*' || nick || '*' || '' id '' || msg, Win)
  502.         end
  503.     end
  504.     ircrexxdisplay(titlline, win)
  505.     Return ""
  506. end
  507.  
  508.  
  509. /* Check the number of messages in the buffer */
  510. if (Verb = '/MSGCHK') then do
  511. msglog = Value(msglog,,Pool)
  512. counter = 0
  513.     if (msglog \= 'ON') then ircrexxdisplay("Message Log DISABLED", Win)    
  514.     Do While Lines(messages.log)
  515.         message = LineIn(messages.log)
  516.         Parse Var message nick id msg
  517.         if nick = '+------------------IceBerg' then do
  518.         end
  519.         else do
  520.             counter = counter + 1
  521.         end
  522.     end
  523.     if (counter = 0) then IrcRexxDisplay('Currently there are no messages saved.', Win)
  524.     if (counter = 1) then IrcRexxDisplay('1 message logged', Win)
  525.     if (counter > 1) then IrcRexxDisplay(counter 'messages logged', Win)
  526.     Return ''
  527. end
  528.  
  529. if (Verb = '/GONE') then do
  530.     if (Parm1 <> '') then do
  531.         IrcRexxCommand('/away' xParm1 xParms,Win)
  532.         IrcRexxCommand('/iceberg msglog on',Win)
  533.         Return ''
  534.     end
  535.     else do
  536.         awaymsg = Value(awaymsg,,Pool)
  537.         IrcRexxCommand('/away' awaymsg,Win)
  538.         IrcRexxCommand('/iceberg msglog on',Win)
  539.         Return ''
  540.     end
  541.     Return ''
  542. end
  543.  
  544. if (Verb = '/BACK') then do
  545.     IrcRexxCommand('/iceberg msglog off',Win)
  546.     IrcRexxCommand('/play',Win)
  547.     IrcRexxCommand('/away',Win)
  548.     Return ''
  549. end
  550.  
  551. /*    End of the message logger functions  */
  552.  
  553. /*  Change the default away statement  */
  554.  
  555. if (Verb = '/AWAYMSG') then do
  556.     if (Parm1 <> '') then do
  557.         Value('awaymsg',xParm1 xParms,Pool)
  558.         TempVar = Value('awaymsg',,Pool)
  559.         IrcRexxDisplay('Away statement changed to:' TempVar,Win)
  560.         Return ''
  561.     end
  562.     else do
  563.         TempVar = Value('awaymsg',,Pool)
  564.         IrcRexxDisplay('Current away statement is:' TempVar,Win)
  565.         Return ''
  566.     end
  567. end
  568.  
  569. /* Encryption Routines */
  570.  
  571. if (Verb = '/CRYPT') then do
  572.     if (xParm1 <> '') then do
  573.         xice = "abcdefghijklmnopqrstuvwxyz1234567890,.-('"
  574.         yice = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ )?@!#$*&=+\/"'
  575.         icex = "Q2W* (J'K9aFs=df)gz7cE,mR/TltC+vb#yZu6UI@"
  576.         icey = 'OHP!L.N4xM?qw"e3Gr5-A1SnD$B\YiX&o8pVhj0k'
  577.         cryptin = xice || yice
  578.         cryptout = icex || icey
  579.         instr = xParm1 xParms 
  580.         outstr = Translate(instr, cryptout, cryptin)
  581.             IrcRexxCommand("#IB2.0#" outstr,Win)
  582.     end
  583.     else do
  584.         IrcRexxDisplay(ErStr1 "You must provide some text to be sent to the",Win)
  585.         IrcRexxDisplay(ErStr2 "current channel or query.",Win)
  586.     end        
  587.     Return ""
  588. end
  589.  
  590. /* Reverse it! */
  591.  
  592. if (Verb = '/REVSAY') then do
  593.      if (Parm1 <> '') then do
  594.     OutStr = Reverse(xParm1 xParms)
  595.     IrcRexxCommand(OutStr,Win)
  596.      end
  597.  
  598.      else do
  599.       IrcRexxDisplay(ErStr1 "You must provide a string of input",Win)
  600.       IrcRexxDisplay(ErStr2 "to be reversed and then sent",Win)
  601.      end
  602.      Return ""
  603. end
  604.  
  605. /* Reverse in /msg!!  */
  606.  
  607. if (Verb = '/REVMSG') then do
  608.      if (Parm1 <> '') then do
  609.     OutStr = "/msg" xParm1 Reverse(xParms)
  610.     IrcRexxCommand(OutStr,Win)
  611.      end
  612.  
  613.      else do
  614.     IrcRexxDisplay(ErStr1, 'You must provide a nick and some text',Win)
  615.     IrcRexxDisplay(ErStr2, 'to be sent to that nick',Win)
  616.      end
  617.  
  618.      Return ""
  619. end
  620.  
  621. /* Reverse in a /me!!  */
  622.  
  623. if (Verb = '/REVME') then do
  624.      if (Parm1 <> '') then do
  625.     OutStr = "/me" Reverse(xParm1 xParms)
  626.     IrcRexxCommand(OutStr,Win)
  627.      end
  628.  
  629.      else do
  630.       IrcRexxDisplay(ErStr1 'You must provide a string of text that you',Win)
  631.       IrcRexxDisplay(ErStr2 'wish sent as a /me command.',Win)
  632.      end
  633.  
  634.      Return ""
  635. end
  636.  
  637. /*********************************************************************/
  638. /*                   OS/2 interface commands                         */
  639. /*********************************************************************/
  640.  
  641. /* Host function (doing an NSLOOKUP (shortened to /nsl)) */
  642.  
  643. if (Verb = '/NSL') then do
  644.    CMD = "C:\OS2\CMD.EXE"
  645.    if (Parm1 <> '') then do
  646.        ADDRESS CMD 'nslookup' xParm1 '| rxqueue'
  647.        nr = queued()
  648.        do i=1 to nr
  649.           Parse pull line
  650.           if line <> ' ' Then IrcRexxDisplay(line,Win)
  651.        end
  652.    end
  653.    else do
  654.       IrcRexxDisplay(ErStr1 "You must provide a hostname or IP",Win)
  655.       IrcRexxDisplay(ErStr2 "address that you wish to look up.",Win)
  656.    end
  657.  
  658.    Return ""
  659. end
  660.  
  661. /* Host function (doing a HOST command) */
  662. if (Verb = '/HOST') then do
  663.    CMD = "C:\OS2\CMD.EXE"
  664.    if (Parm1 <> '') then do
  665.        ADDRESS CMD 'host' xParm1 '| rxqueue'
  666.        nr = queued()
  667.        do i=1 to nr
  668.           Parse pull line
  669.           if line <> ' ' Then IrcRexxDisplay(line,Win)
  670.        end
  671.    end
  672.    else do
  673.       IrcRexxDisplay(ErStr1 "You must provide a hostname or IP",Win)
  674.       IrcRexxDisplay(ErStr2 "address that you wish to look up.",Win)
  675.    end
  676.  
  677.    Return ""
  678. end
  679.  
  680. /* OS ping function (doing an OS/2 ping) */
  681. if (Verb = '/OSPING') then do
  682.     CMD = "C:\OS2\CMD.EXE"
  683.     if (Parm1 <> '') then do
  684.         ADDRESS CMD 'ping' xParm1 '25 2 | rxqueue'
  685.         nr = queued()
  686.         do i=1 to nr
  687.         Parse pull line
  688.         if line <> ' ' Then IrcRexxDisplay(line,Win)
  689.         end
  690.     end
  691.     else do
  692.         IrcRexxDisplay(ErStr1 "You must provide a hostname or IP",Win)
  693.         IrcRexxDisplay(ErStr2 "address that you wish to ping.",Win)
  694.     end
  695.     Return ""
  696. end
  697.  
  698. /* OS command send function */
  699. if (Verb = '/OSSEND') then do
  700.     CMD = "C:\OS2\CMD.EXE"
  701.     if (Parm1 <> '') then do
  702.         ADDRESS CMD xParm1 xParms '| rxqueue'
  703.         nr = queued()
  704.         do i=1 to nr
  705.             Parse pull line
  706.             if line <> ' ' Then IrcRexxCommand('*OS/2*' line,Win)
  707.         end
  708.     end
  709.     else do
  710.         IrcRexxDisplay(ErStr1 "You must provide a command and any appropriate",Win)
  711.         IrcRexxDisplay(ErStr2 "parameters that you wish to run.",Win)
  712.     end
  713.     Return ""
  714. end
  715.  
  716. /* OS command send function */
  717. if (Verb = '/OSMSG') then do
  718.     CMD = "C:\OS2\CMD.EXE"
  719.     if (Parm1 <> '') & (Parms <> '') then do
  720.         ADDRESS CMD yParm2 yParms '| rxqueue'
  721.         nr = queued()
  722.         do i=1 to nr
  723.             Parse pull line
  724.             if line <> ' ' Then IrcRexxCommand('/msg' yParm1 line,Win)
  725.         end
  726.     end
  727.     else do
  728.         IrcRexxDisplay(ErStr1 "You must provide a command and any appropriate",Win)
  729.         IrcRexxDisplay(ErStr2 "parameters that you wish to run.",Win)
  730.     end
  731.     Return ""
  732. end
  733.  
  734. /* OS/2 execute function (doing an OS/2 command) */
  735. if (Verb = '/EXEC') then do
  736.     CMD = "C:\OS2\CMD.EXE"
  737.     if (Parm1 <> '') then do
  738.         ADDRESS CMD xParm1 xParms '| rxqueue'
  739.         nr = queued()
  740.         do i=1 to nr
  741.             Parse pull line
  742.             if line <> ' ' Then IrcRexxDisplay(line,Win)
  743.         end
  744.     end
  745.     else do
  746.         IrcRexxDisplay(ErStr1 "You must provide a command and any appropriate",Win)
  747.         IrcRexxDisplay(ErStr2 "parameters that you wish to run.",Win)
  748.     end
  749.     Return ""
  750. end
  751.  
  752. /*********************************************************************/
  753. /* Split Finder routines - Now we get into some real functionality!  */
  754. /* Some of these routines are called by other processes in these two */
  755. /* scripts and aren't really for the user.                           */
  756. /*********************************************************************/
  757.  
  758. if (Verb = '/GETSERVERS') then do
  759.     Value('srvrget','ON',Pool)
  760.     Value('srvrs.','',Pool)
  761.     Value('srvrs.0','0',Pool)
  762.     Value('cnt','0',Pool)
  763.     IrcRexxDisplay('**** Getting list of active servers from the current server',Win)
  764.     IrcRexxSend('LINKS',Win)
  765.     IrcRexxDisplay('**** This may take a few moments, please be patient.',Win)
  766.     Return
  767. end
  768.  
  769. if (Verb = '/FINDSPLIT') then do
  770.     Value('getcurr','ON',Pool)
  771.     Value('currsvrs.','',Pool)
  772.     Value('currsvrs.0','0',Pool)
  773.     Value('currcnt','0',Pool)
  774.     IrcRexxDisplay('**** Getting list of active servers from the current server',Win)
  775.     IrcRexxSend('LINKS',Win)
  776.     IrcRexxDisplay('**** This may take a few moments, please be patient.',Win)
  777.     Return
  778. end
  779.  
  780. if (Verb = '/WRITESVR') then do
  781.     CALL library
  782.     rc = SysFileDelete('servers.lst')
  783.     LineOut('servers.lst', '#Begin_List#', 1)
  784.     cnt = Value('cnt',,Pool)
  785.     do s = 1 to cnt
  786.         tempword = Value('srvrs.'s,,Pool)
  787.         LineOut('servers.lst', tempword)
  788.     end
  789.     LineOut('servers.lst')
  790.     IrcRexxDisplay(Value('cnt',,Pool) "Servers written to 'servers.lst'",Win)
  791.     Return ''
  792. end
  793.  
  794. if (Verb = '/WRITECURRSVR') then do
  795.     CALL library
  796.     rc = SysFileDelete('current.lst')
  797.     LineOut('current.lst', '#Begin_List#', 1)
  798.     cnt = Value('currcnt',,Pool)
  799.     do s = 1 to cnt
  800.         tempword = Value('currsvrs.'s,,Pool)
  801.         LineOut('current.lst', tempword)
  802.     end
  803.     LineOut('current.lst')
  804.     IrcRexxDisplay(Value('cnt',,Pool) "Servers written to 'current.lst'",Win)
  805.     IrcRexxCommand('/SPLITTERS',Win)
  806.     Return
  807. end
  808.  
  809. if (Verb = '/SPLITTERS') then do
  810.     IrcRexxDisplay('Looking for any split servers.',Win)
  811.     Do While (Lines(servers.lst) = 1)
  812.         tmpline = LineIn(servers.lst)
  813.         if (SysFileSearch(tmpline, current.lst, 'aresult.') = 0) then do
  814.             if (aresult.0 = 0) then do
  815.                 IrcRexxDisplay("IB: Currently Split:" tmpline "",Win) 
  816.             end
  817.         end
  818.     end
  819.     IrcRexxCommand('/ADDNEW',Win)
  820.     Return
  821. end
  822.  
  823. if (Verb = '/ADDNEW') then do
  824.     IrcRexxDisplay('Looking for any new servers',Win)
  825.     Do While (Lines(current.lst) = 1)
  826.         tmpline = LineIn(current.lst)
  827.         if (SysFileSearch(tmpline, servers.lst, 'aresult.') = 0) then do
  828.             if (aresult.0 = 0) then do
  829.                 IrcRexxDisplay("IB: New server found & added:" tmpline "",Win) 
  830.                 junk = LineOut('servers.lst', tmpline)
  831.                 junk = LineOut('servers.lst')
  832.             end
  833.         end
  834.     end
  835.     Return
  836. end
  837.  
  838.  
  839. /*********************************************************************/
  840. /*           Commands to simplify use of OS2Bot on #OS/2             */
  841. /*********************************************************************/
  842.  
  843. if (Verb = '/CALC') then do
  844.     if (Parm1 <> '') then do
  845.         IrcRexxCommand('/msg os2bot calc' xParm1 xParms,Win)
  846.         Return ''
  847.     end
  848.     else do
  849.         IrcRexxDisplay(ErStr1 'You must specify a string to be sent',Win)
  850.         IrcRexxDisplay(ErStr2 'to OS2Bot for evaluation',Win)
  851.         Return ''
  852.     end
  853. end
  854.  
  855. if (Verb = '/PHONE') then do
  856.     if (Parm1 <> '') then do
  857.         IrcRexxCommand('/msg os2bot phone' xParm1, Win)
  858.         Return ''
  859.     end
  860.     else do
  861.         IrcRexxDisplay(ErStr1 'You must specify a string to be sent',Win)
  862.         IrcRexxDisplay(ErStr2 'to OS2Bot for look up',Win)
  863.         Return ''
  864.     end
  865. end
  866.  
  867. /*********************************************************************/
  868. /* This isn't a command we care about so we pass a non-null string   */
  869. /* so that it will be processed normally                             */
  870. /*********************************************************************/
  871.  
  872. Return 'OK'
  873.  
  874. library:
  875.     CALL RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  876.     CALL SysLoadFuncs
  877. Return