home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 35 Internet
/
35-Internet.zip
/
gscr20.zip
/
gmsg.cmd
< prev
next >
Wrap
OS/2 REXX Batch file
|
1997-06-11
|
5KB
|
213 lines
/* Processed for messages Received */
Parse Upper Arg Win Us Prefix Cmd Chan Nick Rest
Parse Arg xWin xUs xPrefix xCmd xChan xNick xRest
Parse Arg ywin yus yprefix ycmd ychan alltext
Pool = 'OS2ENVIRONMENT'
/* tempstr = win||'#'||us||'#'||prefix||'#'||cmd||'#'||chan||'#'||nick||'#'||rest
ircrexxdisplay(tempstr, win) */
/* Auto Rejoin on Kick */
if (Cmd = 'KICK' & Nick = Us) then do
By = substr(Prefix,2)
Posex = pos('!',By)
By = substr(By,1,posex - 1)
Posex = pos(':',xRest)
Reason = substr(xRest,2)
Disp = "*** Kicked by" By "(" || Reason || ")"
IrcRexxDisplay(Disp,Win)
OutStr = "JOIN" Chan
IrcRexxSend(OutStr)
Return ""
End
/* Log anything that is a private conversation if the logger is on */
msglog = value('log',,Pool)
if(cmd='PRIVMSG' & CHAN = Us & msglog = 'on') then do
n = Value('nummsgs',,Pool) + 1
Value('nummsgs',n,Pool)
id = substr(Prefix, 2)
Posex = pos('!', id)
id = substr(id,1,posex -1)
message = id' 'Time()'] 'xNick' 'xRest
Value('msgbuf.'n,message,Pool)
if(n > value('buffer',,Pool)) then do
roll=value('rollbuffer',,pool)
if roll = 'on' then do
do i = 1 to n
nextmsg = value('msgbuf.'i+1,,Pool)
value('msgbuf.'i,nextmsg,Pool)
end
value('nummsgs',n-1,Pool)
end
else do
ircrexxdisplay(' ', win)
ircrexxdisplay('YOUR MESSAGE BUFFER IS FULL', win)
ircrexxdisplay('TYPE /set nummsgs 0 TO RESET', win)
value('nummsgs',n-1,Pool)
end
end
return "OK"
end
/* Actions on Joins to Channel */
if (cmd='JOIN') then do
joinactions=value('joinactions',,pool)
B=right(xprefix, length(xprefix)-1)
NetMask=Substr(xPrefix,2)
posbang=pos('!', NetMask)
NewNick=Substr(Netmask, 1, posbang - 1)
xchan = right(xchan, length(xchan)-1)
if newnick=xus then do
onjoin = value('onjoin',,pool)
if onjoin = '' then return "OK"
ircrexxcommand("/rexx "||onjoin, win)
return "OK"
end
join = value('join',,Pool)
if join \= 'on' then return 'OK'
do i = 1 to joinactions
A=value(host.i,,pool)
actioni=value(action.i,,pool)
call checkmask
if OK then do
do j = 1 to words(actioni)
action=subword(actioni, j, 1)
if action='+o' then ircrexxcommand('/mode '||xchan||' +o '||newnick, win)
if action='+k' then ircrexxcommand('/kick '||newnick||' Autokick', win)
if action='+b' then do
ircrexxcommand('/mode '||xchan||' +b '||A, win)
ircrexxcommand('/kick '||newnick||' Banned', win)
end
if action='+i' then do
ircrexxcommand('/ignore '||A, win)
ircrexxcommand('/notice '||newnick||' Sorry. You are automatically being ignored.', win)
end
if action='+g' then call greetthem
if action='+p' then call greetthem
if action='+n' then call greetthem
if length(action) > 2 then do
greetscr = value('greetscr',,Pool)
if greetscr = 'on' then do
scriptname = right(action, length(action) - 1)
ircrexxcommand('/rexx '||scriptname||' '||newnick, win)
end
end
end
end
end
return "OK"
end
/* Script called when leaving a channel */
if (cmd='PART') then do
onleave=value('onleave',,pool)
if onleave='' then return "OK"
NetMask=Substr(xPrefix,2)
posbang=pos('!', NetMask)
NewNick=Substr(Netmask, 1, posbang - 1)
if newnick=xus then do
ircrexxcommand("/rexx "||onleave, win)
return "OK"
end
return "OK"
end
/* Autokick MirC color codes */
if CMD = 'PRIVMSG' then do
kickmirc=value('kickmirc',,pool)
if kickmirc \= 'on' then return "OK"
do i = 1 to length(alltext)
if substr(alltext, i, 1) = '' then do
NetMask=Substr(xPrefix,2)
posbang=pos('!', NetMask)
NewNick=Substr(Netmask, 1, posbang - 1)
ircrexxcommand('/kick '||newnick||' Kill the mirc escape codes, please.', win)
return "OK"
end
end
return "OK"
end
/* Everything Else */
Return "OK"
/* Pattern Searching Routine used in Hostmasks */
checkmask:
presearch = A
search = ''
do k = 1 to length(presearch)
thischar = substr(presearch, k, 1)
if (thischar='.')|(thischar='*') then do
if thischar = '.' then search = search||'\.'
if thischar = '*' then search = search||'.*'
end
else search = search||thischar
end
joined = B
inlist = Grep(search, joined)
if inlist='0 0' then OK=0
if inlist\='0 0' then OK=1
return ''
/* Auto Greets */
greetthem:
greet=value('greet',,pool)
if greet \= 'on' then return ''
greetmsg = value('greetmsg',,pool)
output = ''
do k = 1 to words(greetmsg)
piece = subword(greetmsg, k, 1)
if piece='$ch' then piece = xchan
if piece='$ni' then piece = newnick
output = output||' '||piece
end
if action = '+g' then ircrexxcommand(output, win)
if action = '+p' then ircrexxcommand('/msg '||newnick||' '||output, win)
if action = '+n' then ircrexxcommand('/notice '||newnick||' '||output, win)
return ''