home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 35 Internet
/
35-Internet.zip
/
gtirc306.zip
/
REXXMSG.CMD
< prev
next >
Wrap
OS/2 REXX Batch file
|
1997-11-24
|
7KB
|
131 lines
/*********************************************************************/
/* REXXMSG.CMD GammaTech IRC Sample REXX Message Exit Script */
/*********************************************************************/
/* */
/* This is a sample REXX script for use with GammaTech IRC. It */
/* provides the following functions. */
/* */
/* 1) Automatically rejoin a channel if we are kicked off. */
/* 2) Autogreet when joining a channel or when others join. */
/* 3) Automatically begin a log file when we join a channel. */
/* */
/* Warning: Do not change this script. Copy it to another name */
/* and modify the copy for backup purposes. */
/* */
/*********************************************************************/
/* */
/* Entry arguments: */
/* */
/* Arg 1 - Window Handle */
/* Arg 2 - Our Nickname */
/* Arg 3 - The message text from IRC */
/* */
/* The third input argument is the full message from the IRC server. */
/* It may be helpful to refer to RFC 1459 to interpret the various */
/* IRC messages. A copy of RFC 1459 is located in the GTIRC */
/* directory. */
/* */
/* The incoming message may be suppressed or ignored. To suppress */
/* the message, return a null ("") string. To allow the message to */
/* be processed normally, return a non-null string. */
/* */
/*********************************************************************/
/* */
/* There are external REXX functions you may use in this REXX */
/* procedure which are described in the online help under Script */
/* programming. A summary of those functions is shown below: */
/* */
/* IrcRexxDisplay(text,win) Display text in a window. */
/* IrcRexxCommand(text,win) Send text or /comamnd to IRC */
/* IrcRexxSend(text,win) Send raw text to server. */
/* IrcRexxVariable(win,name[,value]) Query or set an IRC variable. */
/* IrcRexxWildCard(wildcard,string) Check for wildcard match. */
/* */
/*********************************************************************/
Parse Upper Arg WinHandle OurNick Prefix Cmd Chan Nick Rest
Pool = 'OS2ENVIRONMENT'
/*********************************************************************/
/* We see if this is a kick message for us. If so we format and */
/* display a message in the window and rejoin the channel. */
/* */
/* We send the join command directly to the server because if we */
/* send it as a normal command using IrcRexxCommand() it will be */
/* ignored because the kick has not been processed and it thinks */
/* we are still on the channel. */
/* */
/* We return a null string to suppress the kick message so that the */
/* window for the channel will not be closed. */
/* */
/*********************************************************************/
if (Cmd = 'KICK' & Nick = OurNick) then do
By = substr(Prefix,2)
Posex = pos('!',By)
By = substr(By,1,posex - 1)
Posex = pos(':',Rest)
Reason = substr(Rest,2)
Disp = "*** Kicked by" By "(" || Reason || ")"
IrcRexxDisplay(Disp,WinHandle)
OutStr = "JOIN" Chan
IrcRexxSend(OutStr,WinHandle)
Return ""
End
/*********************************************************************/
/* AutoGreets are lame. But if you really want to autogreet folks */
/* you can enable this script by setting the following variable: */
/* */
/* /var $AutoGreet,:#CHANNEL (channel name in upper case) */
/* */
/*********************************************************************/
if (Cmd = 'JOIN' & Chan = IrcRexxVariable(WinHandle,"$AutoGreet")) then do
Parse Arg . OurNick Prefix Rest
NewNick = substr(Prefix,2)
Posex = pos('!',NewNick)
NewNick = substr(NewNick,1,Posex - 1)
If (NewNick <> OurNick) then do
OutStr = "Hey" NewNick "!!!"
IrcRexxCommand(OutStr,WinHandle)
End
Else do
OutStr = "Hi all"
IrcRexxCommand(OutStr,WinHandle)
End
End
/*********************************************************************/
/* Begin a log file when we join a channel. This feature is disabled */
/* by default. To enable it set the following variable: */
/* */
/* /var $AutoLog,yes */
/* */
/*********************************************************************/
if (Cmd = 'JOIN' & IrcRexxVariable(WinHandle,"$AutoLog") = 'yes') then do
NewNick = substr(Prefix,2)
Posex = pos('!',NewNick)
NewNick = substr(NewNick,1,Posex - 1)
If (NewNick = OurNick) then do
OutStr = "/LOG ON"
IrcRexxCommand(OutStr,WinHandle)
End
End
/*********************************************************************/
/* We don't care about this message so return a non-null string so */
/* that it will be processed normally. */
/*********************************************************************/
Return "OK"