-- file: IntMailCom.Mesa -- edited by Schroeder, November 5, 1980 10:30 AM -- edited by Horning, January 30, 1978 5:26 PM -- edited by Brotz, September 14, 1982 1:13 PM -- edited by Levin, January 16, 1981 3:08 PM DIRECTORY ccD: FROM "ChollaCmdDefs" USING [CleanUpTOCCaches, GetTOCForFile, FinishChollaMailProcess], dsD: FROM "DisplayDefs" USING [ClearDCBs, ClearRectangle], exD: FROM "ExceptionDefs" USING [DisplayException, DisplayExceptionString, messageNotFiled, noFileCantGetMail], ImageDefs USING [StopMesa], inD: FROM "InteractorDefs" USING [AskUserToConfirm, CommandProcedure, Confirm, ConfirmBrackets, leftMargin, MessageTextNbrPtr, rightMargin, TOCTextNbrPtr, TOCTextPainter, UpdateTOCThumbLine], intCommon USING [audioEnabled, cmTextNbr, composedMessageEdited, dmTextNbr, isCholla, mailFileBracketsHouse, newMailTune, retrieveHandle, tocTextNbr, user], lmD: FROM "LaurelMenuDefs" USING [ChangeEditorMenu], opD: FROM "OperationsDefs" USING [AccessNewMailOperation], String USING [EquivalentSubStrings, SubStringDescriptor], tsD: FROM "TOCSelectionDefs" USING [SetTOCSelection], vmD: FROM "VirtualMgrDefs" USING [CleanupCMs, DisplayMessage, FirstFreeTOCIndex, FlushDisplayMessage, GetMessageSize, TOCHandle, TOCIndex, UnlockTOC, WaitForLock], VMDefs USING [FinalizeVM]; IntMailCom: PROGRAM IMPORTS ccD, dsD, exD, ImageDefs, inD, intC: intCommon, lmD, opD, String, tsD, vmD, VMDefs EXPORTS inD = BEGIN OPEN inD; -- Purpose: handles user interactions including the display, keyboard and mouse. This -- division gathers together commands and their arguments and is responsible for the -- display of all error messages. GetMailFileCommand: PUBLIC CommandProcedure = -- Implements Get mail file. Returns current mail file, clears screen selectively, uses -- GetMailFileOperation to obtain new mail, sets up new TOC display. BEGIN -- Calls ReturnMailFileOperation with activeMailFileName and TOCStructure. Clears -- TOC-entries neighborhood and clears DM-text neighborhood. Calls -- GetMailFileOperation with GMFFileName, user's file server name, password and file -- server port; calls DisplayException if failure is reported back. Determines what -- portion of the TOC should be displayed, selects a default selected message interval, -- and calls DisplayTOC to display the TOC. dm: MessageTextNbrPtr = intC.dmTextNbr; tnp: TOCTextNbrPtr = intC.tocTextNbr; key: CARDINAL _ 0; text: STRING = intC.mailFileBracketsHouse.text; IF ~confirmed AND ~ConfirmBrackets[hp: intC.mailFileBracketsHouse, fileExtension: ".mail."L] THEN RETURN; dsD.ClearRectangle[leftMargin, rightMargin, tnp.topY, tnp.bottomY]; dsD.ClearRectangle[leftMargin, rightMargin, dm.topY, dm.bottomY]; IF tnp.toc # NIL AND dm.haveMessage THEN BEGIN key _ vmD.WaitForLock[tnp.toc]; vmD.FlushDisplayMessage[vmD.DisplayMessage[dm.message], key]; vmD.UnlockTOC[tnp.toc, key]; END; dm.haveMessage _ FALSE; [tnp.toc, key] _ ccD.GetTOCForFile[IF text.length = 0 THEN NIL ELSE text, laurel]; IF (tnp.haveToc _ tnp.toc # NIL) THEN TOCTextPainter[tnp, key] ELSE UpdateTOCThumbLine[tnp, key]; IF tnp.toc # NIL THEN vmD.UnlockTOC[tnp.toc, key]; END; -- of GetMailFileCommand -- QuitCommand: PUBLIC CommandProcedure = -- Calls QuitOperation. Calls DisplayException if failure is reported back. BEGIN key: CARDINAL _ 0; tnp: TOCTextNbrPtr = intC.tocTextNbr; toc: vmD.TOCHandle = tnp.toc; IF ~confirmed AND ~Confirm[1] THEN RETURN; IF intC.composedMessageEdited AND vmD.GetMessageSize[intC.cmTextNbr.message] # 0 AND ~AskUserToConfirm[exD.messageNotFiled] THEN RETURN; IF intC.isCholla THEN {ccD.FinishChollaMailProcess[]; ccD.CleanUpTOCCaches[]}; IF tnp.toc # NIL THEN BEGIN dm: MessageTextNbrPtr = intC.dmTextNbr; key _ vmD.WaitForLock[toc]; IF dm.haveMessage THEN vmD.FlushDisplayMessage[vmD.DisplayMessage[dm.message], key]; vmD.UnlockTOC[toc, key]; dm.haveMessage _ FALSE; dsD.ClearRectangle[leftMargin, rightMargin, tnp.topY, tnp.bottomY]; dsD.ClearRectangle[leftMargin, rightMargin, dm.topY, dm.bottomY]; [ , ] _ ccD.GetTOCForFile[NIL, laurel]; tnp.toc _ NIL; tnp.haveToc _ FALSE; END; lmD.ChangeEditorMenu[singleLine]; vmD.CleanupCMs[]; VMDefs.FinalizeVM[]; dsD.ClearDCBs[]; ImageDefs.StopMesa[]; END; -- of QuitCommand -- GetNewMailCommand: PUBLIC CommandProcedure = BEGIN tnp: TOCTextNbrPtr = intC.tocTextNbr; oldFirstFreeIndex: vmD.TOCIndex; toc: vmD.TOCHandle _ tnp.toc; key: CARDINAL _ 0; EquivalentTail: PROCEDURE [string, tail: STRING] RETURNS [BOOLEAN] = -- Returns TRUE iff tail is the suffix of string. BEGIN ssd, tsd: String.SubStringDescriptor; IF tail.length > string.length THEN RETURN[FALSE]; ssd _ [string, string.length - tail.length, tail.length]; tsd _ [tail, 0, tail.length]; RETURN[String.EquivalentSubStrings[@ssd, @tsd]]; END; -- of EquivalentTail -- IF ~tnp.haveToc THEN {exD.DisplayException[exD.noFileCantGetMail]; RETURN}; IF EquivalentTail[intC.mailFileBracketsHouse.text, ".chml"L] THEN {exD.DisplayExceptionString["Cannot read new mail into a Cholla file!"L]; RETURN}; IF confirmed THEN BEGIN exD.DisplayExceptionString["One message at a time mail retrieval. May take longer than Red button retrieval."L]; IF ~inD.Confirm[2] THEN RETURN; END; key _ vmD.WaitForLock[toc]; oldFirstFreeIndex _ vmD.FirstFreeTOCIndex[toc, key]; intC.audioEnabled _ FALSE; IF opD.AccessNewMailOperation [toc, key, intC.retrieveHandle, intC.user.registry, FALSE, confirmed] THEN BEGIN --new items added to TOC dsD.ClearRectangle[leftMargin, rightMargin, tnp.topY, tnp.bottomY]; IF oldFirstFreeIndex < vmD.FirstFreeTOCIndex[toc, key] THEN tsD.SetTOCSelection[toc, key, oldFirstFreeIndex]; TOCTextPainter[tnp, key]; END; vmD.UnlockTOC[toc, key]; intC.audioEnabled _ (intC.newMailTune # NIL); END; -- of GetNewMailCommand -- END. -- of IntMailCom --z19932(635)\f1