home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
AmigActive 13
/
AACD13.ISO
/
AACD
/
System
/
DOpus
/
DAWCB
/
ARexx
/
DAWCB.dopus5
Wrap
Text File
|
2000-03-04
|
4KB
|
155 lines
/*
$VER: DAWCB.dopus5 0.1 (3.3.00) D.Clarke
*/
CookieFile = 'AWeb3:Cache/AWCK'
options results
parse arg port .
address value port
plural. = 's'
plural.1 = ''
if ~show('l','rexxtricks.library') then call addlib('rexxtricks.library',0,-30)
if ~exists(CookieFile) then do
call displayerror('"DAWCB: Cookie file not found!" OK')
exit
end
call forbid()
myportname = "DAWCB.0"
do i = 0 while show("p",myportname)
myportname = "DAWCB."i
end
if ~openport(myportname) then do
call permit()
call displayerror('DAWCB: Could not open message port')
exit
end
call permit()
lister new
handle = result
lister set handle case on
lister set handle display name
lister set handle header 'Save BEFORE closing!'
lister set handle commentlength numlength
lister set handle namelength nlength
lister set handle handler myportname
lister set handle label 'DAWCB'
dopus addtrap '*' myportname
call ReadCookies
call LoadLister
lister refresh handle full
do forever
if waitpkt(myportname) then do
packet = getpkt(myportname)
if packet ~= '00000000'x then do
event = getarg(packet,0)
pname = getarg(packet,2)
arg3 = getarg(packet,3)
select
when event = 'inactive' then leave
when event = 'menu' & arg3 = 2 then call DoView(pname)
when event = 'Delete' | (event = 'menu' & arg3 = 0) then call DoDelete(pname)
when event = 'menu' & arg3 = 1 then call WriteCookies()
otherwise nop
end
end
end
end
dopus remtrap '*'
call closeport(myportname)
exit
LoadLister:
popup.COUNT = 2
popup.0 = 'Delete'
popup.1 = 'Save'
popup.2 = 'View'
ovfrom = copies(' ',30)
ovexpire = copies(' ',30)
ovcpath = copies(' ',80)
do i = 1 to cookie.0
parse var cookie.i ident';'from';'cpath';'accept';'expire
if index(accept,'EXPIRE') > 0 then do
expire = accept
accept = 0
end
accept = (index(accept,'ACCEPT') > 0)
session = (index(upper(ident),'SESSION') > 0)
from = strip(substr(from,pos('DOMAIN=',from) + 7),,'"')
expire = strip(substr(expire,pos('EXPIRES=',expire) + 8),,'"')
cpath = strip(substr(cpath,pos('PATH=',cpath) + 5),,'"')
info.NAME = i
info.DISPLAY = ' '||accept||' '||session||' 'overlay(from,ovfrom)||' '||overlay(expire,ovexpire)||' '||overlay(cpath,ovcpath)
info.MENU = popup.
lister addstem handle info.
lister refresh handle
end
x = cookie.0
lister set handle title cookie.0' Cookie'||plural.x
lister refresh handle full
return
DoDelete: procedure expose cookie. handle plural.
parse arg ncookie
revcookies = ''
do while ncookie ~= ''
parse var ncookie which ncookie
revcookies = which' 'revcookies
end
do while revcookies ~= ''
parse var revcookies which revcookies
if ~stemremove('cookie',which) then do
call displayerror('"DAWCB: Error removing cookie!" OK')
return
end
end
lister clear handle
call LoadLister
return
DoView: procedure expose cookie.
parse arg ncookie
buffer = copies(' ',80)
parse var cookie.ncookie ident';'from';'cpath';'accept';'expire
if index(accept,'EXPIRE') > 0 then do
expire = accept
accept = 0
end
text = overlay(expire,buffer)
say '|'text'|'
dopus request '"'translate(overlay(ident,buffer),'""','"')'" OK'
dopus request '"'translate(overlay(from,buffer),'""','"')'" OK'
dopus request '"'translate(overlay(cpath,buffer),'""','"')'" OK'
dopus request '"'translate(overlay(expire,buffer),'""','"')'" OK'
dopus request '"'translate(overlay(accept,buffer),'""','"')'" OK'
return
displayerror: procedure
parse arg message
command flash
dopus request '"'message'" OK'
return
ReadCookies:
if ~readfile(CookieFile,'cookie') then do
call DoRequest('DAWCB: Unable to read cookie file!" OK')
exit
end
return
WriteCookies:
if ~writefile(CookieFile,'cookie') then do
call displayerror('"DAWCB: Error writing cookie file!" OK')
exit
end
return