                      -- POP.BAT CONFIGURATION --

@echo off

:Start                                       ::COMMENTS::
    cd\pop
    echo ATZ1>COM2
    PORTAL %1 %2 %3 %4                    :** DEFINE ERRORLEVELS **
     IF ERRORLEVEL 254 goto MemError      :~~~~~~~~~~~~~~~~~~~~~~~~
     IF ERRORLEVEL 253 goto ModemError     ::NOTE: Errorlevels numbers
     IF ERRORLEVEL 252 goto OvrError       ::      must ALWAYS be in
     IF ERRORLEVEL 251 goto FossilError    ::      descending order!
     IF ERRORLEVEL 201 goto HumanCaller    ::BBS caller logon
     IF ERRORLEVEL 180 goto BWDoorDn       ::BlueWave mail door download
     IF ERRORLEVEL 175 goto BWReader       ::Call BlueWave mail reader
     IF ERRORLEVEL 170 goto BWDoorUp       ::BlueWave mail door upload
     IF ERRORLEVEL 160 goto Nightly        ::Midnight maintence routines
     IF ERRORLEVEL 155 goto InBound        ::Inbound file & mail manager
     IF ERRORLEVEL 150 goto FileMgr        ::Process new files & .TICs
     IF ERRORLEVEL 110 goto ViewLog        ::View Telegard SYSOP.LOG
     IF ERRORLEVEL 101 goto LocalBBS       ::Local logon
     IF ERRORLEVEL 0 goto END
	goto Start

:HumanCaller                              :** BBS CALLER ROUTINE **
    BBSBATCH                              :~~~~~~~~~~~~~~~~~~~~~~~~

:LocalBBS                                 :** LOCAL LOGON ROUTINE **
    echo ATH1>COM2                        :~~~~~~~~~~~~~~~~~~~~~~~~~
	cd\tg
     TELEGARD -N1 -L -Q
    goto Start

:InBound                                  :** INBOUND FILE & MESSAGE MGR **
    echo ATH1>COM2                        :~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	del POPUSAGE.T00
	LOGUSAGE 3
    cd\msg\in
    if exist NODEDIFF.A* goto NodeDiff     ::Check for new nodediff
    goto MailMgr                           ::If none, check for mail

:NodeDiff                                 :** NODEDIFF MANAGER **
    cd\msg\in                             :~~~~~~~~~~~~~~~~~~~~~~
     ARCE NODEDIFF.A* c:\node              ::Unpack new nodediff
    cd\node
     FASTV7                                ::Compile nodelist (w/FastV7)
    goto MailMgr

:MailMgr                                  :** INCOMING MAIL MANAGER **
    cd\sq                                 :~~~~~~~~~~~~~~~~~~~~~~~~~~~
     SQUISH IN OUT LINK SQUASH -q          ::Toss new mail with Squish
     SEAL SCAN                             ::Check mail with Seal
     SQUISH SQUASH -q                      ::Check again with Squish
    goto FileMgr

:FileMgr                                  :** INCOMING FILES MANAGER **
    cd\msg\in                             :~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     if exist *.ZIP call C:\THD\THDTERM /S c:\msg\in ::Scan with THDPro
     if exist *.TIC goto DoTics            ::Check for new .TIC files
     if exist *.BAD del *.BAD              ::Delete bad mail packets
     if exist *.ZIP move *.ZIP \fil\uploads /N ::Move scanned files
    goto Start

:DoTics                                   :** TIC FILE MANAGER **
    cd\sq                                 :~~~~~~~~~~~~~~~~~~~~~~
     call c:\pop\CRC_OK /TI=c:\msg\in /FI=c:\msg\in /L=c:\tg\logs\seal.log
     call SEAL SCAN TIC ANNOUNCE           ::Process TIC & announce new files
     SQUISH IN OUT SQUASH -q               ::Process announce message(s)
    goto Start

:ViewLog                                   ::View SYSOP.LOG from PoP WFC
	echo ATH1>COM2
	cd\tg\logs
     call Q SYSOP.LOG                      ::Substitute your favorite editor
	goto Start

:Nightly                                  :** MIDNIGHT MAINT MANAGER **
    cd\tg                                 :~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     call FA2FB -DATE                      ::Convert fbases to TG old-style
     call c:\bat\TGLIST                    ::Update NEW FILES lists
     call FB2FA -DATE                      ::Convert fbases to TG new-style
     TELEGARD -F                           ::Validate new file lists
     INDEX build all                       ::Rebuild all TG data indices
	cd\sq
     sqpack c:\msg\fido\*                  ::Pack Squish echomail
     sqpack c:\msg\net\*                   ::Pack Squish netmail
	goto Start

:BWDoorDn                                 :** BLUEWAVE DOOR DOWNLOADS **
    echo ATH1>COM2                        :~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	cd\doors\bw
     call bwmail /Kbob_lotspeich /D        ::Download BlueWave mail packet
    goto BWReader

:BWReader                                 :** READ BLUEWAVE MAIL **
    echo ATH1>COM2                        :~~~~~~~~~~~~~~~~~~~~~~~~
    call c:\bat\bw.bat                     ::Load BlueWave mail reader
     if exist c:\mail\*.NEW goto BWDoorUp  ::If new mail was created...
    goto Start

:BWDoorUp                                 :** BLUEWAVE DOOR UPLOADS **
    echo ATH1>COM2                        :~~~~~~~~~~~~~~~~~~~~~~~~~~~
	cd\doors\bw
     call bwmail /Kbob_lotspeich /U        ::Upload BlueWave mail packet
    cd\sq
     squish out squash                     ::Toss new mail to Fido
	goto Start

:MemError                                  ::MEMORY ERROR routine
	echo Memory Allocation Error - Please Check Your System.
	goto ReBoot

:ModemError                                ::MODEM ERROR routine
	echo Error Initializing Modem - Please Check Your Modem,
	echo Cabling And Your Portal Port And Speed Configuration.
	goto ReBoot

:OvrError                                  ::OVERLAY ERROR routine
	echo Error Initializing Overlay Manager - Please Check Your System
	goto ReBoot

:FossilError                               ::FOSSIL DRIVER ERROR Routine
	echo No Fossil Loaded - Please Check Your System.
	goto ReBoot

:ReBoot
    call AUTOBOOT /NIL                     ::Run system auto-rebooter

:END                                       ::Shut down Portal of Power
    echo ATH1>COM2
    cls
    echo ESC[10;23H ESC[1;36m┌─────────────────────────────┐ ::Replace "ESC"
    echo ESC[11;23H │    » WE ARE NOW DOWN ! «    │          ::with ALT-27
    echo ESC[12;23H └─────────────────────────────┘ESC[0m    ::character,
    echo.
