/*
   QuitMiamiRT.rexx
   $VER: QuitMiamiRT.rexx v1.0 (22.12.96) by Scott J. Konowal sjkonowa@freenet.columbus.oh.us
*/

/* QuitMiamiRT.rexx is FREEWARE. Use as you like.  */
/* If you think this macro could be better, please */
/* send me any changes you suggest, as I am just a */
/* beginning ARexx programmer.                     */

/* This macro will check if Miami is running. If   */
/* Miami is running, it will ask, via reqtools, if */
/* you want to disconnect or quit Miami.           */
/* Originally intended for ToolManager.            */

/* Requires ReqTools, RexxReqTools, Miami and of   */
/* course ARexx.                                   */

/* Tested with A1200 GVP Series II Turbo + '03     */
/* Running AmigaOS 3.x, Miami 1.1b & 1.8.1,        */
/* RexxReqTools.library 37.95 and ReqTools.library */
/* 38.1434                                         */

/* Thanks goes out to Holger Kruse for the         */
/* excellent modem-based TCP, Miami.               */

OPTIONS RESULTS

/* Set the following for font preferences. Do NOT  */
/* include the .font extension.                    */

FONTTYPE = Topaz
FONTSIZE = 8

/* Do not edit below here unless you know what you */
/* are doing. This is not commented since most of  */
/* it pretty much straight-forward (and I am not   */
/* very good at explaining myself.)                */

IF ~EXISTS("libs:rexxreqtools.library") THEN DO
    SAY "You need RexxReqTools.library"
    EXIT
END

IF ~SHOW('libraries','rexxreqtools.library') THEN DO
    CALL ADDLIB("rexxreqtools.library",0,-30)
END

MIAMISTAT = Show('ports','MIAMI.1')

IF MIAMISTAT = 0 THEN DO
    CALL rtezrequest('Miami'||'0A'x||'is not running.',,'QuitMiamiRT.','rtez_flags = ezreqf_centertext' 'rt_font = '||FONTTYPE||'.font/'||FONTSIZE)
    EXIT
END

IF MIAMISTAT = 1 THEN DO
    ADDRESS 'MIAMI.1'
    ISONLINE

    IF RC=0 THEN DO
        CALL rtezrequest('Miami is not online.'||'0A'x||'Do you want to quit?','_Quit|_Cancel','QuitMiamiRT.','rtez_flags = ezreqf_centertext' 'rt_font = '||FONTTYPE||'.font/'||FONTSIZE 'rtez_defaultresponse = 0')
        IF RESULT = 1 THEN DO
            QUIT
        END
        ELSE EXIT
    END

    IF RC=1 THEN DO
        CALL rtezrequest('Miami is ONLINE!'||'0A'x||'Do you want to'||'0A'x||'disconnect or quit?','_Disconnect|_Quit|_Cancel','QuitMiamiRT.','rtez_flags = ezreqf_centertext' 'rt_font = '||FONTTYPE||'.font/'||FONTSIZE 'rtez_defaultresponse = 0')
        IF RESULT = 1 THEN DO
            OFFLINE
        END
        IF RESULT = 2 THEN DO
            OFFLINE
            QUIT
        END
        ELSE EXIT
    END
END 
