home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Enigma Amiga Life 109
/
EnigmaAmiga109CD.iso
/
software
/
sviluppo
/
rxmui
/
examples
/
bang.amirx
< prev
next >
Wrap
Text File
|
1999-12-21
|
8KB
|
275 lines
/**/
parse arg n
options results
signal on halt
signal on break_c
l="rmh.library";if ~show("L",l) then;if ~addlib(l,0,-30) then exit
if AddLibrary("rxmui.library","rxsocket.library")~=0 then exit
call rxmuiopt("debugmode showerr")
call initAll(n)
call handleApp
exit
/***********************************************************************/
initAll: procedure expose globals.
parse arg n
call createApp
call set("mwin","open",1)
call getattr("mwin","open","o")
if o=0 then do
say "can't open window"
exit
end
"GETCHANNEL"
global.ch=result
global.reasone = ""
global.MaskType = 0
call selected(n)
return
/***********************************************************************/
handleApp: procedure expose globals.
ctrl_c=2**12
s=0
do forever
call handle("APP","H",s)
do i=0 to h.num-1
id=h.i
select
when id="QUIT" then exit
when id="GETNICK" then call selected
when id="MASKTYPE" then do
global.banMask=makeMask()
call set("banmask","contents",global.banMask)
end
when id="OP" then call op
when id="WHOIS" then call whois
when id="UINFO" then call UInfo
when id="DEOP" then call deop
when id="KICK" then call kick
when id="BAN" then call ban
when id="KBAN" then call kban
when id="TBAN" then call tban
otherwise nop
end
end
s=Wait(or(h.signals,ctrl_c))
if and(s,ctrl_c)>0 then exit
end
exit
/***********************************************************************/
err: procedure expose globals. sigl rxmuierror
parse arg res
say signl "["res"]"
say getrxmuistring(res) "in line" sigl-1 rxmuierror
exit
/***********************************************************************/
createApp: procedure expose globals.
app.Title="Show"
app.Version="$VER: Show 1.0 (17.12.99)"
app.Copyright="©1999, alfie"
app.Author="alfie"
app.Description="RxMui Show"
app.Base="SHOW"
app.SubWindow="mwin"
mwin.ID="MAIN"
mwin.Title="RxMUI Show"
mwin.Contents="mgroup"
mgroup.horiz=1
mgroup.0="sg"
sg.class="group"
sg.columns=2
sg.0=label("_Nick","double")
sg.1="ng"
ng.class="group"
ng.spacing=0
ng.horiz=1
ng.0=string("nick","n")
ng.1=MakeObj("getnick","popbutton",18)
sg.2=label("_BanMask","double")
sg.3=string("banmask","b")
sg.4=label("_Reasone","double")
sg.5=string("reasone","r")
sg.6=label("Ban _Mask","double")
sg.7="bmg"
bmg.class="group"
bmg.horiz=1
bmg.0="masktype"
masktype.weight=20
masktype.class="cycle"
masktype.entries="nick|user|ip|bad|domain"
bmg.1=hspace()
mgroup.1 = balance()
mgroup.2="bg"
bg.class="group"
bg.weight=0
bg.innerleft=0
bg.innerright=0
bg.innertop=0
bg.innerbottom=0
bg.spacing=0
bg.columns=2
call child("bg",button("whois","_Whois"))
call child("bg",button("UInfo","_UInfo"))
call child("bg",button("op","_Op"))
call child("bg",button("deop","_DeOp"))
call child("bg",button("kick","_Kick"))
call child("bg",button("ban","Ban"))
call child("bg",button("tban","_TBan"))
call child("bg",button("kban","_KBan"))
call child("bg",hvspace())
res=NewObj("APPLICATION","APP")
if res~=0 then call err(res)
call Notify("MWIN","CLOSEREQUEST",1,"APP","RETURNID","QUIT")
call Notify("nick","newcontents","everytime","APP","setvar","GLOBAL.NICK")
call Notify("reasone","newcontents","everytime","APP","setvar","GLOBAL.REASONE")
call Notify("banmask","newcontents","everytime","APP","setvar","GLOBAL.BANMASK")
call Notify("reasone","newcontents","everytime","APP","setvar","GLOBAL.REASONE")
call Notify("masktype","active","everytime","APP","setvar","GLOBAL.MASKTYPE")
call Notify("quit","pressed",0,"app","returnid")
call Notify("getnick","pressed",0,"app","returnid")
call Notify("masktype","active","everytime","app","returnid")
call Notify("op","pressed",0,"app","returnid")
call Notify("whois","pressed",0,"app","returnid")
call Notify("deop","pressed",0,"app","returnid")
call Notify("kick","pressed",0,"app","returnid")
call Notify("ban","pressed",0,"app","returnid")
call Notify("kban","pressed",0,"app","returnid")
call Notify("tban","pressed",0,"app","returnid")
call Notify("kruser" ,"pressed",0,"app","returnid")
return
/***********************************************************************/
halt:
break_c:
exit
/**************************************************************************/
whois: procedure expose global.
if global.nick=="" then return
"RAW WHOIS" global.nick
return
/**************************************************************************/
UInfo: procedure expose global.
if global.nick=="" then return
"RAW ctcp UINFO" global.nick
return
/**************************************************************************/
op: procedure expose global.
if global.nick=="" then return
"SAY /OP" global.nick
return
/**************************************************************************/
deop: procedure expose global.
if global.nick=="" then return
"SAY /DEOP" global.nick
return
/**************************************************************************/
kick: procedure expose global.
if global.nick=="" then return
r=global.reasone
if r=="" then r="Goodbye honey"
"SAY /KICK" global.nick r
return
/**************************************************************************/
ban: procedure expose global.
if global.nick=="" | global.banMask="" then return
"SAY /BAN" global.banMask
return
/**************************************************************************/
kban: procedure expose global.
if global.nick=="" | global.banMask="" then return
if a="" then return
"SAY /DEOP" global.nick
"SAY /BAN" global.banMask
call kick
return
/**************************************************************************/
tban: procedure expose global.
if global.nick=="" | global.banMask="" then return
call kban
"SAY /RX rexx/authpunish" global.ch global.banMask 60
return
/**************************************************************************/
kruseIT: procedure expose global.
if global.nick=="" then return
"SAY /RX kruser" global.nick
return
/**************************************************************************/
selected: procedure expose global.
parse arg n
if n=="" then do
"GETSELECTEDUSER"
if rc==5 then return
global.nick=result
end
else global.nick=n
call set("nick","contents",global.nick)
global.banMask=makeMask()
call set("banmask","contents",global.banMask)
return
/**************************************************************************/
syntax:
"ECHO" rc sigl
exit
/**************************************************************************/
makeMask: procedure expose global.
"USERHOST" global.nick
if rc==5 then return ""
u=result
parse var u user"@"rest
if pos(left(user,1),"~-")~=0 then parse var user +1 user
select
when global.MaskType==0 then do
mask="*"global.nick"*!*@*"
return mask
end
when global.MaskType==1 then do
mask="*!*"user"*@*"
return mask
end
when global.MaskType==2 then do
mask="*!*@"rest
return mask
end
when global.MaskType==3 then do
if IsDotAddr(rest) then return "*!*@"rest
mask="*!*@"
do i=1 to length(rest)
if DataType(substr(rest,i,1),"N") then do
mask=mask||"*"
do while DataType(substr(rest,i,1),"N");i=i+1;end
end
mask=mask||substr(rest,i,1)
end
return mask
end
when global.MaskType==4 then do
if IsDotAddr(rest) then do
parse var rest p1"."p2"."
mask="*!*@"p1"."p2".*"
end
else do
p=LastPos(".",rest)
mask="*!*@*."right(rest,length(rest)-p)
end
return mask
end
otherwise nop
end
return u
/**************************************************************************/