home *** CD-ROM | disk | FTP | other *** search
- /*
- $VER: ShowEvent.thor 1.0 by Remco van Hooff
-
- Shows the current event in the main window.
- */
- /*trace results*/
-
- p = address show('P')
- thorport = pos('THOR.',p)
- if thorport > 0 then thorport = word(substr(p,thorport),1)
- else do
- say 'THOR port not found!'
- exit
- end
-
- if ~show('p', 'BBSREAD') then do
- address command
- "run >nil: `GetEnv THOR/THORPath`bin/LoadBBSRead"
- "WaitForPort BBSREAD"
- end
-
- address(thorport)
- options results
-
- GETSELECTEDEVENT
- if rc = 5 then do
- REQUESTNOTIFY TEXT '"The events window is not open."' BT '"_Ok"'
- exit
- end
- if rc = 30 then do
- REQUESTNOTIFY TEXT '"'THOR.LASTERROR'"' BT '"_Ok"'
- exit
- end
- event = result
-
- CURRENTSYSTEM stem CURRENT
- if(rc ~= 0) then do
- REQUESTNOTIFY TEXT '"'THOR.LASTERROR'"' BT '"_Ok"'
- exit
- end
- bbs = '"'CURRENT.BBSNAME'"'
-
- address BBSREAD
- GETBBSDATA bbsname bbs stem DATA
- if(rc ~= 0) then do
- address(thorport)
- REQUESTNOTIFY TEXT '"'BBSREAD.LASTERROR'"' BT '"_Ok"'
- exit
- end
- path = DATA.BBSPATH
- fevent = DATA.FIRSTEVENT
- levent = DATA.LASTEVENT
- if fevent > levent then do
- address(thorport)
- REQUESTNOTIFY TEXT '"No event found."' BT '"_Ok"'
- exit
- end
-
-
- READBREVENT bbsname bbs eventnr event tagsstem TAG
- if(rc ~= 0) then do
- address(thorport)
- REQUESTNOTIFY TEXT '"'BBSREAD.LASTERROR'"' BT '"_Ok"'
- exit
- end
- msg = path||TAG.MSGFILE
-
- address(thorport)
- SHOWTEXT file msg
- if(rc ~= 0) then do
- REQUESTNOTIFY TEXT '"'THOR.LASTERROR'"' BT '"_Ok"'
- exit
- end
-
- exit
-