home *** CD-ROM | disk | FTP | other *** search
- /*
- $VER: LhaDirStoneD-handler 1.0 (18.11.95)
-
- modified by Stone-D (Laga Hale)
-
- Mail me at stone-d@eldar.demon.co.uk
-
- Custom handler for LhADir.StoneD.
- */
-
- options results
- options failat 11
-
- parse arg portname
- parse var portname '.' portno
- address value portname
-
- if ~show('l','rexxsupport.library') then
- call addlib('rexxsupport.library',0,-30,0)
-
- call openport('LhaDirStoneD-handler'portno)
-
- dopus addtrap copy 'LhaDirStoneD-handler'portno
- dopus addtrap move 'LhaDirStoneD-handler'portno
- dopus addtrap delete 'LhaDirStoneD-handler'portno
- dopus addtrap parent 'LhaDirStoneD-handler'portno
- dopus addtrap makedir 'LhaDirStoneD-handler'portno
-
- do forever
- if waitpkt('LhaDirStoneD-handler'portno) then do
- packet=getpkt('LhaDirStoneD-handler'portno)
-
- event=getarg(packet,0)
- handle=getarg(packet,1)
- name=getarg(packet,2)
- user=getarg(packet,3)
-
- if upper(event)='MAKEDIR' then do
- cmd='MAKEDIR'
- address command 'Run >NIL: <NIL: rx DOpus5:arexx/LhADir.StoneD' cmd portname handle '"'name'"'
- end
-
- if upper(event)='COPY' then do
- cmd='COPY'
- address command 'Run >NIL: <NIL: rx DOpus5:arexx/LhADir.StoneD' cmd portname handle '"'name'"'
- end
-
- if upper(event)='MOVE' then do
- cmd='MOVE'
- address command 'Run >NIL: <NIL: rx DOpus5:arexx/LhADir.StoneD' cmd portname handle '"'name'"'
- end
-
- if upper(event)='DELETE' then do
- cmd='DELETE'
- address command 'Run >NIL: <NIL: rx DOpus5:arexx/LhADir.StoneD' cmd portname handle '"'name'"'
- end
-
- if upper(event)='PARENT' then do
- lister query handle path
- winpath=result
- oldpath=getarg(packet,4)
- test=upper(winpath)
- newpos=lastpos('/',winpath,lastpos('/',winpath)-1)
- newpos1=lastpos(':',winpath,lastpos('/',winpath)-1)
- if newpos1>newpos then newpos=newpos1
- newpath=left(winpath,newpos)
- lister read handle '"'newpath'"' force
- address command 'Run >NIL: <NIL: rx DOpus5:arexx/LhADir.StoneD GETDIR' portname ' ' handle '""'
- end
-
- if upper(event)='DOUBLECLICK' then do
- lister query handle entry '"'name'"' stem fileinfo.
- if fileinfo.type>0 then do /* it's a dir */
- name=name'/'
- cmd='GETDIR'
- end
- else
- if pos(upper(right(name,4)),'.Lha')>0 then /* archive in an archive */
- cmd='GETDIR'
- else
- cmd='DOUBLECLICK'
- address command 'Run >NIL: <NIL: rx DOpus5:arexx/LhADir.StoneD' cmd portname handle '"'name'"'
- end
-
- if upper(event)='INACTIVE' then do
- lister query handle path
- winpath=result
- oldpath=getarg(packet,4)
- test=upper(winpath)
- if winpath=left(oldpath,length(winpath))&(pos('.Lha/',test)>0) then /* user did parent */
- address command 'Run >NIL: <NIL: rx DOpus5:arexx/LhADir.StoneD GETDIR' portname handle '""'
- else
- address command 'Delete >NIL: T:LhaDir.list'handle 'QUIET' /* remove temp file */
- end
-
- if upper(event)='DROP' then do
- name=strip(name,'t')
- if right(name,1)=':' then
- lister read handle '"'name'"' force /* user dropped a volume icon */
- end
-
- call reply(packet,0)
- end
- end
-