-- file: IntMBXState.mesa
-- edited by Schroeder, December 19, 1980 11:34 AM
-- edited by Brotz, March 18, 1981 5:10 PM

DIRECTORY
intCommon: FROM "IntCommon",
inD: FROM "InteractorDefs",
RetrieveDefs,
String;

IntMBXState: PROGRAM
IMPORTS inD, intC: intCommon, String
EXPORTS inD =

BEGIN


ReportMBXState: PUBLIC PROCEDURE[mbxState: RetrieveDefs.MBXState] =
BEGIN
house: inD.HousePtr = intC.newMessagesHouse;
lastMessage: STRING = [40];
String.AppendString[lastMessage, house.text];
house.text.length ← 0;
String.AppendString[house.text,
SELECT mbxState FROM
badName, badPwd =>
IF intC.user.password.length = 0
THEN "Login please."L
ELSE "Bad user name or password."L,
cantAuth => "Can’t contact authentication server."L,
-- someEmpty => "Can’t contact some inbox servers."L,
allDown => "Can’t contact any inbox servers."L,
allEmpty, someEmpty => "Mailbox empty at "L,
unknown => ""L,
ENDCASE --notEmpty-- => "You have new mail."L];
IF mbxState = allEmpty OR mbxState = someEmpty THEN BEGIN
time: STRING = intC.timeHouse.text;
fudge: CARDINAL = IF time[time.length-12] = ’ THEN 1 ELSE 0;
ssd: String.SubStringDescriptor ← [time, time.length-12+fudge, 5-fudge];
String.AppendSubString[house.text, @ssd];
IF mbxState = allEmpty THEN String.AppendChar[house.text, ’.];
END;
IF NOT String.EquivalentString[lastMessage, house.text] THEN BEGIN
IF intC.audioEnabled AND mbxState = notEmpty AND intC.newMailTune # NIL
THEN inD.PlayTune[intC.newMailTune];
house.houseRefresher[house]
END;
END; -- ReportMBXState --


END. -- IntMBXState --