home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 14 / CDACTUAL.iso / cdactual / demobin / share / os2 / GTIRC104 / REXXMSG.CMD < prev    next >
Encoding:
Text File  |  1995-11-26  |  7.8 KB  |  146 lines

  1. /*********************************************************************/
  2. /* REXXMSG.SCR   GammaTech IRC Sample REXX Message Exit Script       */
  3. /*********************************************************************/
  4. /*                                                                   */
  5. /* This is a sample REXX script for use with GammaTech IRC. It       */
  6. /* provides the following functions.                                 */
  7. /*                                                                   */
  8. /* 1) Automatically rejoin a channel if we are kicked off.           */
  9. /* 2) Autogreet when joining a channel or when others join.          */
  10. /* 3) Automatically begin a log file when we join a channel.         */
  11. /*                                                                   */
  12. /* Warning: Do not change this script. Copy it to another name       */
  13. /* and modify the copy for backup purposes.                          */
  14. /*                                                                   */
  15. /*********************************************************************/
  16. /*                                                                   */
  17. /* Entry arguments:                                                  */
  18. /*                                                                   */
  19. /* Arg 1 - Window handle                                             */
  20. /* Arg 2 - Current Nickname                                          */
  21. /* Arg 3 - The message text from IRC                                 */
  22. /*                                                                   */
  23. /* The third input argument is the full message from the IRC server. */
  24. /* It may be helpful to refer to RFC 1459 to interpret the various   */
  25. /* IRC messages. A copy of RFC 1459 is located in the GTIRC          */
  26. /* directory.                                                        */
  27. /*                                                                   */
  28. /* The incoming message may be suppressed or ignored. To suppress    */
  29. /* the message, return a null ("") string. To allow the message to   */
  30. /* be processed normally, return a non-null string.                  */
  31. /*                                                                   */
  32. /*********************************************************************/
  33. /*                                                                   */
  34. /* There are external REXX functions you may use in this REXX        */
  35. /* procedure which are described below.                              */
  36. /*                                                                   */
  37. /* IrcRexxDisplay(text,win)  This function displays "text" in the    */
  38. /* window. It does not send the text over IRC. The "text" parameter  */
  39. /* is a null terminated string containing the text to display.       */
  40. /*                                                                   */
  41. /* The "win" parameter describes the window in which to display the  */
  42. /* text. Use a null string to cause the text to be displayed in the  */
  43. /* control window. To display the text in the window where the       */
  44. /* message would normally be displayed, use the first argument       */
  45. /* passed to this procedure.                                         */
  46. /*                                                                   */
  47. /* IrcRexxCommand(text,win)  This function sends "text" over IRC.    */
  48. /* The "text" is a null terminated string containing the text to     */
  49. /* be sent. The text may be text to the channel or a IRC command.    */
  50. /*                                                                   */
  51. /* The "win" parameter describes the window in which to display the  */
  52. /* output of the text or command. Use a null string to cause the     */
  53. /* output to be displayed in the control window. To display the      */
  54. /* output in the window where the  message would normally be         */
  55. /* displayed, use the first argument passed to this procedure.       */
  56. /*                                                                   */
  57. /* IrcRexxSend(text)  This function sends the "text" as a raw        */
  58. /* string directly to the server. A carriage return and line feed    */
  59. /* is appended to the text before transmission.                      */
  60. /*                                                                   */
  61. /* IrcRexxWildCard(wildcard,string)  This function checks string     */
  62. /* for a match against wildcard. If a match is found MATCH is        */
  63. /* returned. If no match is found NOMATCH is returned.               */
  64. /*                                                                   */
  65. /*********************************************************************/
  66. Parse Upper Arg Win Us Prefix Cmd Chan Nick Rest
  67.  
  68. Pool = 'OS2ENVIRONMENT'
  69.  
  70. /*********************************************************************/
  71. /* We see if this is a kick message for us. If so we format and      */
  72. /* display a message in the window and rejoin the channel.           */
  73. /*                                                                   */
  74. /* We send the join command directly to the server because if we     */
  75. /* send it as a normal command using IrcRexxCommand() it will be     */
  76. /* ignored because the kick has not been processed and it thinks     */
  77. /* we are still on the channel.                                      */
  78. /*                                                                   */
  79. /* We return a null string to suppress the kick message so that the  */
  80. /* window for the channel will not be closed.                        */
  81. /*                                                                   */
  82. /*********************************************************************/
  83.  
  84. if (Cmd = 'KICK' & Nick = Us) then do
  85.    By = substr(Prefix,2)
  86.    Posex = pos('!',By)
  87.    By = substr(By,1,posex - 1)
  88.  
  89.    Posex = pos(':',Rest)
  90.    Reason = substr(Rest,2)
  91.  
  92.    Disp = "*** Kicked by" By "(" || Reason || ")"
  93.    IrcRexxDisplay(Disp,Win)
  94.  
  95.    OutStr = "JOIN" Chan
  96.    IrcRexxSend(OutStr)
  97.    Return ""
  98. End
  99.  
  100. /*********************************************************************/
  101. /* AutoGreets are lame. But if you really want to autogreet folks    */
  102. /* you can enable this script by setting the following variable:     */
  103. /*                                                                   */
  104. /* /rexxvar autogreet :#channel                                      */
  105. /*                                                                   */
  106. /*********************************************************************/
  107.  
  108. if (Cmd = 'JOIN' & Chan = VALUE('AUTOGREET',,Pool)) then do
  109.    Parse Arg . Us Prefix Rest
  110.  
  111.    NewNick = substr(Prefix,2)
  112.    Posex = pos('!',NewNick)
  113.    NewNick = substr(NewNick,1,Posex - 1)
  114.  
  115.    If (NewNick <> Us) then do
  116.       OutStr = "Hey" NewNick "!!!"
  117.       IrcRexxCommand(OutStr,Win)
  118.    End
  119.  
  120.    Else do
  121.       OutStr = "Hi all"
  122.       IrcRexxCommand(OutStr,Win)
  123.    End
  124. End
  125.  
  126. /*********************************************************************/
  127. /* Begin a log file when we join a channel. This feature is disabled */
  128. /* by default. To enable it set the following variable:              */
  129. /*                                                                   */
  130. /* /rexxvar autolog on                                               */
  131. /*                                                                   */
  132. /*********************************************************************/
  133.  
  134. if (Cmd = 'JOIN' & VALUE('AUTOLOG',,Pool) = 'ON') then do
  135.    OutStr = "/LOG ON"
  136.    IrcRexxCommand(OutStr,Win)
  137. End
  138.  
  139. /*********************************************************************/
  140. /* We don't care about this message so return a non-null string so   */
  141. /* that it will be processed normally.                               */
  142. /*********************************************************************/
  143.  
  144. Return "OK"
  145.  
  146.