home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-08-06 | 25.4 KB | 1,100 lines |
- ; $VER: AMBBS.script 1.50 (06.08.94)
- ; ABBS/MBBS Script for THOR
- ; By Eivind Nordseth, Ultima Thule Software
-
- REQUEST OFF
-
- set $dox = ""
- set $oldconf = ""
- set $gethold = "FALSE"
- set $errmsg = ""
- set $fixtimeout = ""
- set $dtmpfile = ""
- set $dropconfcap = ""
- set $readmode = ""
- set $private = ""
- set $userinfo = "FALSE"
- set $repfile = ""
- set $qwkcommand = "Q QWK"
- set $qwkcfg = "FALSE"
- set $qwkerr = "TRUE"
- set $rengrab = ""
- set $doctrlx = "FALSE"
- set $dogreet3 = "FALSE"
-
- cli "thor:bin/ScriptServ \""$BBSName"\" WRITECFG"
- if exists "t:privupl"$BBSName then cli "delete >nil: \"t:privupl"$BBSName"\""
- if exists "t:NoLogOut" then cli "delete >nil: t:NoLogOut"
-
- varfile "t:"$BBSName".CONFIG"
-
- readvar $BBSID
- readvar $BBSType
- readvar $UserName
- readvar $Path
- readvar $PostConf
- readvar $UpLoadDir
- readvar $NewFiles
- readvar $AutoPDnl
- readvar $AutoLogoff
- readvar $UseColors
- readvar $Name
- varfile close
-
- cli "delete >nil: \"t:"$BBSName".CONFIG\""
-
- set $LogFile = $Path"ScriptMsg.txt"
-
- when "\r\nNO CARRIER\r\n" goto AllDone
- send "^K\n\n"
-
- autoxfer off ; Turn off G&R commands
- autoup off ; Turn off Zmodem autoupload
- autodown on ; Turn on Zmodem autodownload
-
- if !$BBSType == "MBBS_SP_QWK" then goto noSPMBBS
- set $qwkcommand = "Q SP QWK"
- set $BBSType = "MBBS_QWK"
-
- noSPMBBS:
- if $BBSType == "MBBS" then menuselect TRANSLATE 1 8 ; Use IBN character set
- if $BBSType == "ABBS" then menuselect TRANSLATE 1 0 ; Use ISO character set
- if $BBSType == "MBBS_QWK" then menuselect TRANSLATE 1 8 ; Use IBN character set
- if $BBSType == "ABBS_QWK" then menuselect TRANSLATE 1 0 ; Use ISO character set
-
- converse "FIRST name?" $UserName" Q\n"
- converse "will echo):" "\p\n" ; ^K^K slettet her.
-
- if $BBSType == "ABBS_QWK" then menuselect TRANSLATE 1 8 ; Use IBN character set
-
- when "From #3: Just" set $dogreet3 = "TRUE"
- when "--more--" send "C"
- when "coming online" gosub SysOp
- when "Include original" send "\n"
- when "Private message" send $private"\n"
- when "other users (Enter=N)" send "\n"
- when "Kommando" send "U SPR;;\n"
- when "The following" gosub GotPrivUpl
-
- gosub SetupTimeout
-
- if $BBSType == "MBBS" then set $docmd = "CHAT N U L 0 S IBN\n"
- if $BBSType == "ABBS" then set $docmd = "CHAT N U L 0 S ISO GF MBBS\n"
- if $BBSType == "MBBS_QWK" then set $docmd = "CHAT N U L 0 S IBN\n"
- if $BBSType == "ABBS_QWK" then set $docmd = "CHAT N U L 0 S IBN GF QWK\n"
- gosub DoCommand
- dlwhen
- dlwhen ; Last whens not needed anymore
-
- ;***************** Event loop
-
- while exists "t:"$BBSName".EVENT" DO
-
- varfile "t:"$BBSName".EVENT"
-
- readvar $eventnr
- readvar $event
- readvar $sendto
- readvar $conf
- readvar $msgfile
- readvar $replyto
- readvar $subject
- readvar $private
- readvar $filename
- readvar $notify
- readvar $filedescr
- readvar $detailed
- readvar $frommsgnr
- readvar $tomsgnr
- readvar $localfile
- readvar $commandstring
- readvar $boolean
-
- varfile close
-
- if $doctrlx == "TRUE" then send "^X"
- set $doctrlx = "FALSE"
-
- if $event == "0" then gosub EnterMsg
- if $event == "1" then gosub ReplyMsg
- if $event == "2" then gosub JoinConf
- if $event == "3" then gosub ResignConf
- if $event == "4" then gosub DownloadFile
- if $event == "5" then gosub UploadFile
- if $event == "6" then gosub GetConfList
- if $event == "7" then gosub ConfigureBBS ; Event not in Thor, yet.
- if $event == "8" then gosub SendUserInfo
- if $event == "10" then gosub GetNewFiles
- if $event == "11" then gosub CommandEvent
- if $event == "12" then gosub AutoLogOff
-
- cli "thor:bin/ScriptServ \""$BBSName"\" DONE "$eventnr
-
- endwhile
-
- if $doctrlx == "TRUE" then send "^X"
- set $rengrab = "y"
-
- ;***************** Grab messages
-
- if $BBSType == "MBBS_QWK" then goto HandleMBBSQWK
- if $BBSType == "ABBS_QWK" then goto HandleABBSQWK
- set $docmd = "R DUMP ALL\n"
- gosub DoCommand
- gosub NoTimeout
-
- when "<0>" goto grabd
-
- converse "Command" "SE Z\n^K"
- gosub NoTimeout
-
- grabd:
- dlwhen
-
- goto AfterGrabing
-
- ;***************** Do ABBS_QWK packet handling
- HandleABBSQWK:
- if !exists $UpLoadDir$BBSID".REP" then goto NoABBSRepFile
-
- set $docmd = "Q MU\n"
- gosub DoCommand
-
- when "parsed successfully" set $qwkerr = "FALSE"
-
- wait "B01"
- upload $UpLoadDir$BBSID".REP",Z
- gosub NoTimeout
-
- capture $Path"QWKMsg.txt"
-
- wait "Main Command"
-
- capture off
- dlwhen
- gosub SetUpTimeout
-
- if $qwkerr == "TRUE" then goto ABBSRepFileFail
-
- cli "delete >nil: "$UpLoadDir$BBSID".REP"
- cli "thor:bin/ScriptServ \""$BBSName"\" PACKAGEDONE"
- cli "delete >nil: "$Path"QWKMsg.txt"
- send "^X"
- goto NoABBSRepFile
-
- ABBSRepFileFail:
- set $appendsource = $Path"QWKMsg.txt"
- set $appenddest = $LogFile
- gosub AppendFile
- send "^X"
-
- NoABBSRepFile:
-
- set $docmd = "R DUMP ALL\n"
- gosub DoCommand
- gosub NoTimeout
-
- when "<0>" goto grabd2
-
- converse "Command" "SE Z\n^K"
-
- grabd2:
- dlwhen
-
- goto AfterGrabing
-
- ;***************** Do MBBS_QWK packet handling
- HandleMBBSQWK:
- set $docmd = $qwkcommand"\n"
- gosub DoCommand
-
- wait "QWK (? for menu)"
-
- if $qwkcfg == "FALSE" then goto NoQWKConfig
- send "C"
-
- converse "ation (? for menu)" "P"
- converse "se a packer" "L"
- converse "ation (? for menu)" "O"
- converse "se a protocol" "Z"
-
- wait "ation (? for menu)"
- set $qwkfilelist = "y"
- when "New file list Off" set $qwkfilelist = "n"
- send "F"
- wait "ation (? for menu)"
- dlwhen
- if $qwkfilelist == $NewFiles then goto NoChgQWKList
-
- send "F"
- wait "ation (? for menu)"
-
- NoChgQWKList:
- send "R"
- wait "QWK (? for menu)"
-
- NoQWKConfig:
- if !exists $UpLoadDir$BBSID".REP" then goto NoRepFile
-
- when "REP-file ok." set $repfile = "OK"
-
- send "U"
- wait "B01"
- upload $UpLoadDir$BBSID".REP",Z
- gosub NoTimeout
-
- wait "Reading REP"
- capture $Path"QWKMsg.txt"
-
- wait "QWK (? for menu)"
- capture off
-
- dlwhen
- gosub SetUpTimeout
- if !$repfile == "OK" then goto RepFileFail
-
- cli "delete >nil: "$UpLoadDir$BBSID".REP"
- cli "thor:bin/ScriptServ \""$BBSName"\" PACKAGEDONE"
- cli "delete >nil: "$Path"QWKMsg.txt"
- goto NoRepFile
-
- RepFileFail:
- set $appendsource = $Path"QWKMsg.txt"
- set $appenddest = $LogFile
- gosub AppendFile
-
- NoRepFile:
- send "D"
- gosub NoTimeout
- when "Something's gone wrong!" goto QWKWrong
- when "transferred with the packet?" send "N\n"
-
- converse "QWK (? for menu)" "R"
-
- timeout 3 goto QWKDone
- QWKLoop:
- wait ""
- goto QWKLoop
- QWKWrong:
- wait "Command"
- gosub Startlogfile
- write $LogFile "Error: MBBS-QWK failed making package\n"
-
- QWKDone:
- dlwhen
- dlwhen
- gosub SetUpTimeout
- send "^X"
-
-
- ;***************** Rename the grab
-
- AfterGrabing:
- set $rengrab = "y"
-
- ;***************** Auto dnload private files
-
- if !$AutoPDnl == "y" then goto NoPrivUpl
- if !exists "t:privupl"$BBSName then goto NoPrivUpl
-
- cli "thor:bin/ScriptServ >\"t:privupl"$BBSName".tmp\" \""$BBSName"\" PrivUploadFile \"t:privupl"$BBSName"\""
-
- if !exists "t:privupl"$BBSName".tmp" then goto NoPrivUpl
-
- varfile "t:privupl"$BBSName".tmp"
-
- PrivLoop:
- readvar $filename
- if $filename == "" then goto PrivLoopEnd
- if $filename == "EOF" then goto PrivLoopEnd
-
- gosub dfPlain
- goto PrivLoop
-
- PrivLoopEnd:
- varfile close
- cli "delete >nil: \"t:privupl"$BBSName".tmp\""
-
- NoPrivUpl:
-
- ;***************** Get files in hold
-
- if exists "t:privupl"$BBSName then cli "delete >nil: \"t:privupl"$BBSName"\""
- if !$gethold == "TRUE" then goto NoHold
-
- set $docmd = "F GET\n"
- gosub DoCommand
- gosub NoTimeout
-
- set $docmd = "F DEL *\n"
- gosub DoCommand
-
- NoHold:
- if $BBSType == "MBBS_QWK" then goto AfterNewFiles
- if !$NewFiles == "y" then goto AfterNewFiles
-
- ;***************** Capture Newfiles.txt
-
- set $docmd = ""
- gosub DoCommand
-
- when "Detailed list (Enter=N):" send "n\n"
-
- cli "Delete >nil: "$Path"Newfiles.txt"
- capture $Path"Newfiles.txt"
- send "F N ;;\n"
- gosub NoTimeout
-
- when "Read Command" goto NewFilesDone
- wait "File Command"
-
- NewFilesDone:
- dwhen "Read Command"
- dwhen "Detailed list (Enter=N):"
- capture off
- send "^X"
-
- AfterNewFiles:
-
- ;***************** Ready for logout
-
- if $AutoLogoff == "n" then goto NoLogOut
-
- if exists "t:NoLogOut" then goto NoLogOut
-
- set $docmd = "CHAT A U L 26\n"
- gosub DoCommand
-
- set $docmd = "G Y N Y\n"
- gosub DoCommand
-
- when "\r\nNO CARRIER\r\n" goto Hanged
- delay 2
- repeat
- hangup
- delay 2
- until !CARRIER
-
- Hanged:
- dlwhen
- goto AllDone
-
- NoLogOut:
- set $docmd = "CHAT A U L 26 W R\n"
- gosub DoCommand
-
- dwhens
- timeout 0
- wait "\r\nNO CARRIER\r\n"
-
- AllDone:
- CLI "run >nil: rx thor:rexx/AddFileNote.rexx"
- request on
- end
-
- SendReturn:
- if $Timeouts == "2" then timeout 20 gosub Hung
- if $Timeouts == "1" then set $Timeouts = "2"
- if $Timeouts == "0" then set $Timeouts = "1"
- send "^X"
- return
-
- Hung:
- beep
- message "\nI think the board has hung."
- message "\nTurn off this script within 20 seconds to stop me from logging out !!"
- delay 20
- beep
- message "\nWARNING: Logout in progress.\n"
- hangup
- goto AllDone
-
- SysOp:
- send "Sorry, you are trying to chat with a script.\n"
- send "Please put me back to the BBS at once.\n"
- set $Timeouts = "0"
- wait "SYSOP is going offline!"
- set $Timeouts = "0"
- return
-
-
- ;************************************************
- DoCommand:
- if $dogreet3 == "TRUE" then converse "Command" "no 4 Yo! This script represents "$Name"\n"
- converse "Command" $docmd
- if !$fixtimeout == "" then gosub SetupTimeout
- if !$dtmpfile == "" then gosub DelDFwhens
- if !$dropconfcap == "" then gosub DropConfCap
- if !$rengrab == "" then gosub RenameGrab
- set $dogreet3 = "FALSE"
- return
-
-
- ;************************************************
- GotPrivUpl:
- capture "t:privupl"$BBSName
-
- wait "Comman"
- send "^X"
- capture off
- return
-
- ;************************************************
- ; Enter message subroutine
- ; Uses variables:
- ; $conf - conference for message
- ; $sendto - user message is to (Empty string is equal to ALL)
- ; $subject - subject of message
- ; $msgfile - file message is in
- ; $private - private message (y/n)
- EnterMsg:
- if !EXISTS $Path$msgfile then return
-
- when "enter both the first AND" gosub etomyself
- when "that name is not registered" gosub etomyself
- when "ALL is not allowed here!" gosub etomyself
-
- when "READ ONLY conference. Us" goto einpost1
- when "not a member of this con" goto einpost2
- when "Invalid conference selec" goto einpost3
- when "Topics are:" goto einpost4
- when "Send message to" gosub sendmsgto
-
- doconf:
- if $conf == $oldconf then goto InConf
-
- converse "Command" "J "$conf"\n"
- if !$fixtimeout == "" then gosub SetupTimeout
- if !$dtmpfile == "" then gosub DelDFwhens
- if !$dropconfcap == "" then gosub DropConfCap
-
- set $oldconf = $conf
-
- InConf:
- if $sendto == "" then set $sendto = "ALL"
-
- converse "Command" "E\n"
- if !$fixtimeout == "" then gosub SetupTimeout
- if !$dtmpfile == "" then gosub DelDFwhens
- if !$dropconfcap == "" then gosub DropConfCap
-
-
- set $dlewhen = "FALSE"
- set $dox = ""
- gosub SendMessage
-
- if $dlewhen == "TRUE" then goto DlEWhenDone
- dlwhen
- dlwhen
- dlwhen
- dlwhen
- dlwhen
- dlwhen
- dlwhen
- dlwhen
-
- set $dlewhen = "TRUE"
- DlEWhenDone:
- return
-
- etomyself:
- gosub Startlogfile
- write $LogFile "Error: Conference "$conf", unable to enter message to "$sendto"\n"
- write $LogFile " Message entered to yourself\n"
- set $errmsg = "Unable to enter message to "$sendto
- set $sendto = "^X"
- return
-
- einpost4:
- gosub Startlogfile
- write $LogFile "Error: Invalid conference topic: "$conf"\n"
- write $LogFile " Message to "$sendto" entered in "$PostConf" instead\n"
- set $errmsg = "Invalid conference topic: "$conf
- send "\n"
- set $oldconf = ""
- goto einpost
- einpost3:
- gosub Startlogfile
- write $LogFile "Error: Invalid conference selection: "$conf"\n"
- write $LogFile " Message to "$sendto" entered in "$PostConf" instead\n"
- set $errmsg = "Invalid conference selection: "$conf
- gosub FixJoinErr
- set $oldconf = ""
- goto einpost
- einpost2:
- gosub Startlogfile
- write $LogFile "Error: User "$sendto" in not a member of conference "$conf"\n"
- write $LogFile " Message entered in "$PostConf" instead\n"
- set $errmsg = "User "$sendto" in not a member of conference "$conf
- goto einpost
- einpost1:
- gosub Startlogfile
- write $LogFile "Error: Conference "$conf" is READ ONLY\n"
- write $LogFile " Message to "$sendto" entered in "$PostConf" instead\n"
- set $errmsg = "Conference "$conf" is READ ONLY"
- einpost:
- set $conf = $PostConf
- goto doconf
-
- sendmsgto:
- if $sendto == "^X" then goto smt1
- send $sendto"\n"
- return
- smt1:
- set $sendto = $UserName
- send "^X"
- return
-
-
- ;************************************************
- ; Reply message subroutine
- ; Uses variables:
- ; $conf - conference for message
- ; $replyto - reply to message
- ; $subject - subject of message
- ; $msgfile - file message is in
- ; $private - private message (y/n)
- ; $sendto - user the message is to
- ReplyMsg:
- if !EXISTS $Path$msgfile then return
-
- when "READ ONLY conference you" goto readonlyconf
- when "Invalid conference selec" goto invalidconf
- when "Topics are:" goto invalidtopic
- when "not available for reply." goto notavail
- when "not a member of this con" goto nomember
-
- if $conf == $oldconf then goto InConf2
-
- converse "Command" "J "$conf"\n"
- if !$fixtimeout == "" then gosub SetupTimeout
- if !$dtmpfile == "" then gosub DelDFwhens
- if !$dropconfcap == "" then gosub DropConfCap
-
- set $oldconf = $conf
- InConf2:
- converse "Command" "R RE "$replyto"\n"
- if !$fixtimeout == "" then gosub SetupTimeout
- if !$dtmpfile == "" then gosub DelDFwhens
- if !$dropconfcap == "" then gosub DropConfCap
-
- set $dlrewhen = "FALSE"
- set $dox = "^X"
- gosub SendMessage
-
- if $dlrewhen == "TRUE" then goto DlReWhenDone
- dlwhen
- dlwhen
- dlwhen
- dlwhen
- dlwhen
-
- set $dlrewhen = "TRUE"
- DlReWhenDone:
- return
-
- readonlyconf:
- gosub Startlogfile
- write $LogFile "Error: Conference "$conf" is READ ONLY, unable to reply message "$replyto"\n"
- write $LogFile " Message entered in "$PostConf" instead\n"
- set $errmsg = "Conference "$conf" is READ ONLY, unable to reply message "$replyto
- set $conf = $PostConf
-
- goto na1
-
- invalidconf:
- gosub Startlogfile
- write $LogFile "Error: Invalid conference selection: "$conf"\n"
- write $LogFile " Unable to reply message "$replyto"\n"
- write $LogFile " Message entered in "$PostConf" instead\n"
- set $errmsg = "Invalid conference selection: "$conf"\n Unable to reply message "$replyto
-
- set $conf = $PostConf
-
- gosub FixJoinErr
-
- goto na1
-
- invalidconf:
- gosub Startlogfile
- write $LogFile "Error: Invalid conference topic: "$conf"\n"
- write $LogFile " Unable to reply message "$replyto"\n"
- write $LogFile " Message entered in "$PostConf" instead\n"
- set $errmsg = "Invalid conference topic: "$conf"\n Unable to reply message "$replyto
- set $conf = $PostConf
- send "\n"
- goto na1
-
- nomember:
- gosub Startlogfile
- write $LogFile "Error: "$sendto" is not member of conference: "$conf"\n"
- write $LogFile " Unable to reply message "$replyto"\n"
- write $LogFile " Message entered in "$PostConf" instead\n"
- set $errmsg = $sendto" is not a member of conference: "$conf"\n Unable to reply message "$replyto
-
- set $conf = $PostConf
-
- goto na1
-
- notavail:
- if $private == "y" then goto napriv
-
- gosub Startlogfile
- write $LogFile "Error: Message "$replyto" in "$conf" not available for reply\n"
- write $LogFile " Message entered instead\n"
- set $errmsg = "Message "$replyto" not available for reply"
-
- goto na1
-
- napriv:
- gosub Startlogfile
- write $LogFile "Error: Message "$replyto" in "$conf" not available for reply\n"
- write $LogFile " Message entered in "$PostConf" instead\n"
- set $errmsg = "Message "$replyto" in "$conf" is not available for reply"
-
- set $conf = $PostConf
-
- na1:
- set $dlrewhen = "TRUE"
- dlwhen
- dlwhen
- dlwhen
- dlwhen
- dlwhen
- goto Entermsg
-
- ;************************************************
- ; Subroutine for sending message
- SendMessage:
- when "--7-" goto sendit
- converse "Subject" $dox$subject"\n"
- wait "--7-"
- sendit:
- dlwhen
- if $userinfo == "FALSE" then goto nouserinfo
-
- if $BBSType == "ABBS" then gosub SendABBSClear
- if $BBSType == "ABBS_QWK" then gosub SendABBSClear
-
- if $BBSType == "MBBS" then send "^KC"
- if $BBSType == "MBBS_QWK" then send "^KC"
-
- nouserinfo:
- send "^KZ"
- if $errmsg == "" then goto noerrmsg
- send "Thor scripting error:\n "$errmsg"\n\n"
- set $errmsg = ""
- noerrmsg:
- ascsend $Path$msgfile
-
- send "\w^Z^Z"
- return
-
- ;************************************************
- ; ABBS clear editor
- SendABBSClear:
- send "^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y"
- send "^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y"
- send "^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y"
- send "^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y"
- send "^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y"
- send "^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y"
- send "^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y"
- send "^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y"
- send "^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y"
- send "^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y"
- send "^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y"
- send "^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y"
- send "^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y"
- send "^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y"
- send "^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y"
- send "^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y"
- return
-
- ;************************************************
- ; Download file subroutine
- ; Uses variables:
- ; $filename - name of file to download
- DownloadFile:
- converse "Command" "F ADD "$filename"\n"
- if !$fixtimeout == "" then gosub SetupTimeout
- if !$dtmpfile == "" then gosub DelDFwhens
- if !$dropconfcap == "" then gosub DropConfCap
-
- set $dtmpfile = $filename
- capture "t:filedesc.txt"
- when "File not found!" gosub fnotfound
- when "You are not allowed" gosub fnotaccess
- when "ate files may not be move" gosub dferr
- set $gethold = "TRUE"
- return
-
- dferr:
- converse "Command" "F D "$dtmpfile"\n"
- gosub NoTimeout
- return
-
- dfPlain:
- set $docmd = "F D "$filename"\n"
- gosub DoCommand
-
- set $dtmpfile = $filename
- capture "t:filedesc.txt"
- when "File not found!" gosub fnotfound
- when "You are not allowed" gosub fnotaccess
- when "ate files may not be move" gosub dfPlain
- gosub NoTimeout
-
- return
-
- fnotaccess:
- gosub Startlogfile
- write $LogFile "Error: Unable to download file \""$dtmpfile"\", you don't have download access\n"
- return
-
- fnotfound:
- gosub Startlogfile
- write $LogFile "Error: Unable to download file \""$dtmpfile"\", file not found\n"
- return
-
- DelDFwhens:
- dwhen "File not found!"
- dwhen "You are not allowed"
- dwhen "ate files may not be move"
- set $dtmpfile = ""
- capture off
- return
-
- ;************************************************
- NoTimeout:
- set $fixtimeout = "d"
- timeout 0
- return
-
- SetupTimeout:
- set $fixtimeout = ""
- set $Timeouts = "0"
- timeout 60 gosub sendreturn
- return
-
- ;************************************************
- GetConfList:
- set $docmd = ""
- gosub DoCommand
-
- cli "Delete >nil: "$Path"Conferences.txt"
- capture $Path"Conferences.txt"
-
- when "<U>nread" SEND "A\n"
- send "R SH\n"
- set $dropconfcap = "j"
-
- return
-
- DropConfCap:
- dwhen "<U>nread"
- capture off
- set $dropconfcap = ""
- return
-
- ;************************************************
- ; Upload file subroutine
- ; Uses variables:
- ; $filename - name of file to upload
- ; $filedescr - short description of file
- ; $notify - download notification (y/n)
- ; $detailed - detailed description (y/n)
- ; $sendto - private upload to user (empty string/"ALL" = public file)
- ; $localfile - path/filename to upload.
- ; $conf - Try to make file private to conf (if $conf != "")
-
- UploadFile:
- set $msgfile = ""
-
- if $localfile == "" then set $localfile = $UpLoadDir$filename
- if !exists $localfile then goto nofileupload
-
- if !$conf == "" then gosub JoinConf
-
- when "enter both the first AND" goto puperr
- when "that name is not registered" goto puperr
- when "ALL is not allowed here!" goto puperr
-
- when "Invalid file name!" goto upinvfile
- when "File exists already!" goto fexists
- when "each download" send $notify"\n"
-
- when "file to be publicly ava" send "\n"
- when "Directory name, <?>=lis" send "\n"
-
- if $conf == "" then when "rivate to confer" send "n\n"
- if !$conf == "" then when "rivate to confer" send "y\n"
-
- if !$sendto == "" then set $docmd = "F PUP "$sendto"\n"
- if $sendto == "ALL" then set $docmd = "F UP\n"
- if $sendto == "" then set $docmd = "F UP\n"
-
- if $doctrlx == "TRUE" then send "^X"
- converse "Command" $docmd
- if !$fixtimeout == "" then gosub SetupTimeout
- if !$dtmpfile == "" then gosub DelDFwhens
- if !$dropconfcap == "" then gosub DropConfCap
-
- converse "ile name" $filename"\n"
- converse "ion of file" $filedescr"\n"
-
- wait "B01"
-
- upload $localfile,Z
- gosub NoTimeout
-
- when "Command" goto uplfail
-
- if $detailed == "" then goto NoDetailed
-
- converse "description (Enter=Y)" "Y\n"
- gosub SetupTimeout
- set $msgfile = $detailed
- gosub SendMessage
- goto fixfail
-
- NoDetailed:
- converse "description (Enter=Y)" "N\n"
-
- fixfail:
- dlwhen
- fixupl: dlwhen
- dlwhen
- dlwhen
- dlwhen
- dlwhen
- dlwhen
- dlwhen
-
- wait "Command"
- set $doctrlx = "TRUE"
- return
-
- puperr:
- gosub Startlogfile
- write $LogFile "Error: Unable to do a private upload of "$filename"\n"
- write $LogFile " User "$sendto" is not registered\n"
- send "^X\n"
- goto fixupl
-
- upinvfile:
- gosub Startlogfile
- write $LogFile "Error: Unable to upload "$filename", filename is invalid\n"
- send "^X\n"
- goto fixupl
-
- fexists:
- gosub Startlogfile
- write $LogFile "Error: Unable to upload "$filename", file already exists\n"
- send "^X\n"
- goto fixupl
-
- nofileupload:
- gosub Startlogfile
- write $LogFile "Error: Unable to upload "$filename", file not found\n"
- return
-
- uplfail:
- gosub Startlogfile
- write $LogFile "Error: Unable to upload "$filename", upload failed\n"
- goto fixfail
-
- ;************************************************
- ; Join conference
- ; Uses variables:
- ; $conf - conference to join
- JoinConf:
- when "Invalid conference sele" gosub joinerr
- when "Topics are:" gosub topicserr
-
- set $docmd = "J "$conf"\n"
- gosub DoCommand
- set $oldconf = $conf
-
- wait "Command"
- dwhen "Invalid conference sele"
- dwhen "Topics are:"
- set $doctrlx = "TRUE"
-
- return
-
- joinerr:
- gosub Startlogfile
- write $LogFile "Error: Invalid conference selection: "$conf", Unable to join\n"
- gosub FixJoinErr
- set $oldconf = ""
- return
-
- topicserr:
- gosub Startlogfile
- write $LogFile "Error: Invalid conference topic: "$conf", Unable to join\n"
- send "\n"
- set $oldconf = ""
- return
-
-
- ;************************************************
- ; Resign conference
- ; Uses variables:
- ; $conf - conference to resign
- ResignConf:
- when "Invalid conference sel" goto reserr
-
- converse "Command" "J "$conf"\n"
- if !$fixtimeout == "" then gosub SetupTimeout
- if !$dtmpfile == "" then gosub DelDFwhens
- if !$dropconfcap == "" then gosub DropConfCap
-
- converse "Command" "RES Y\n"
- if !$fixtimeout == "" then gosub SetupTimeout
- if !$dtmpfile == "" then gosub DelDFwhens
- if !$dropconfcap == "" then gosub DropConfCap
-
- set $oldconf = ""
- fixresign:
- dlwhen
-
- return
-
- reserr:
- gosub Startlogfile
- write $LogFile "Error: Invalid conference selection: "$conf", Unable to resign\n"
-
- gosub FixJoinErr
-
- goto fixresign
-
- ;************************************************
- Startlogfile:
- if !exists $LogFile then write $LogFile "Messages from script:\n"
- return
-
- ;************************************************
- ; Send user info
- ; Uses variables:
- ; $msgfile - file user info is in
- SendUserInfo:
- converse "Command" "Q EDIT\n"
- if !$fixtimeout == "" then gosub SetupTimeout
- if !$dtmpfile == "" then gosub DelDFwhens
- if !$dropconfcap == "" then gosub DropConfCap
-
- converse "number displayed (Enter=" "y\n"
-
- set $userinfo = "TRUE"
-
- gosub SendMessage
-
- set $userinfo = "FALSE"
-
- return
-
- ;************************************************
- FixJoinErr:
- if $BBSType == "MBBS" then converse "name to join" "\n"
- if $BBSType == "MBBS_QWK" then converse "name to join" "\n"
-
- if $BBSType == "ABBS" then send "^K"
- if $BBSType == "ABBS" then converse "Join conference:" "\n"
-
- return
-
- ;************************************************
- RenameGrab:
- set $rengrab = ""
- cli "thor:bin/ScriptServ \""$BBSName"\" RENAMEGRAB"
- cli "run >nil: sys:rexxc/rx 'address THOR.01 RESCAN'"
- return
-
- ;************************************************
- ; Append a file to the en of the other.
- ; Uses variables:
- ; $appendsource - File to append.
- ; $appenddest - Destination.
- AppendFile:
- if !exists $appenddest then goto afNotExists
-
- cli "join >nil: \""$appenddest"\" \""$appendsource"\" TO \""$appenddest".tmp\""
- cli "delete >nil: \""$appenddest"\""
- cli "rename >nil: \""$appenddest".tmp\" \""$appenddest"\""
- cli "delete >nil: \""$appendsource"\""
- return
-
- afNotExists:
- cli "rename >nil: \""$appendsource"\" \""$appenddest"\""
- return
-
- ;************************************************
- ; Do a custom command
- ; Uses variables:
- ; $commandstring - Command to execute.
- CommandEvent:
- write $LogFile "Executing custom command:\n"
-
- converse "Command" $commandstring"\n"
- if !$fixtimeout == "" then gosub SetupTimeout
- if !$dtmpfile == "" then gosub DelDFwhens
- if !$dropconfcap == "" then gosub DropConfCap
- capture $LogFile
-
- wait "Command"
- capture off
- write $LogFile "\n"
- set $doctrlx = "TRUE"
- return
-
- ;************************************************
- GetNewFiles:
- set $NewFiles = "y"
- wait "Command"
- set $doctrlx = "TRUE"
- return
-
- ;************************************************
- ; Set the autologoff flag.
- ; Uses variables:
- ; $boolean - Logoff (y/n)
- AutoLogOff:
- set $AutoLogoff = $boolean
- wait "Command"
- set $doctrlx = "TRUE"
- return
-
- ;************************************************
- ; Set up BBS configuration
- ConfigureBBS:
- if $BBSType == "MBBS" then goto SetMBBSMode
- if $BBSType == "MBBS_QWK" then goto SetMBBSMode
-
- set $docmd = "R\n"
- gosub DoCommand
- when "Read Ref Co" set $readmode = "1"
- when "Read Co" set $readmode = "2"
- wait "Command"
- dlwhen
- dlwhen
- send "^X"
- if $readmode == "2" then goto AfterSetMode
- set $docmd = "MODE\n"
- gosub DoCommand
- goto AfterSetMode
-
- SetMBBSMode:
- set $qwkcfg = "TRUE"
-
- set $docmd = "R MODE M\n"
- gosub DoCommand
-
- AfterSetMode:
- set $docmd = "u m y "$UseColors" "$UseColors" y n y\n"
- gosub DoCommand
- if $BBSType == "ABBS" then set $docmd = "sp n n\n"
- if $BBSType == "ABBS" then gosub DoCommand
-
- return
-