DIRECTORY Atom USING [GetPropFromList, PutPropOnList], BasicTime USING [FromPupTime, GMT, Now, Unpack, Unpacked], Convert USING [RopeFromUnpackedTime], FS USING [Error, ExpandName, GetName, nullOpenFile, Open, OpenFile], GVBasics USING [ItemHeader, ItemType, RName, Timestamp], GVRetrieve USING [Accept, Close, Create, Failed, GetItem, Handle, MailboxState, MBXState, NewUser, NextItem, NextMessage, NextServer, ServerName, ServerState, StartMessage], IO USING [GetBlock, int, PutFR, rope, STREAM, time], MessageWindow USING [Append, Blink], PeanutProfile USING [activeMailFile, automaticNewMail, workingDirectory], PeanutRetrieve USING [], PeanutSendMail USING [simpleUserName, userRName], PeanutWindow USING [dirtyMessageSetIcon, messageSetIcon, OutputRope, SetNewMail], PrincOpsUtils USING [], -- needed by Process.SetPriority Process USING [Detach, priorityBackground, SetPriority], PutGet USING [FromFileC, FromRope], Rope USING [Cat, Concat, Equal, Fetch, Find, FromChar, FromRefText, Index, Length, ROPE, Size, Substr], TEditDisplay USING [EstablishLine], TEditDocument USING [TEditDocumentData], TextEdit USING [DocFromNode, FromRope], TextNode USING [FirstChild, LastSibling, Ref], TiogaFileOps USING [InsertNode, Ref, SetContents, SetFormat], TiogaMenuOps USING [DefaultMenus, FirstLevelOnly], TiogaOps USING [CancelSelection, GetSelection, LastChild, Location, Lock, LockSel, Next, Parent, PutProp, Ref, SelectBranches, SelectionGrain, SelectPoint, SetSelection, ToSecondary, Unlock, UnlockSel, ViewerDoc], UserCredentials USING [Get], ViewerClasses USING [Lock, Viewer], ViewerEvents USING [RegisterEventProc, ViewerEvent], ViewerOps USING [AddProp, EnumerateViewers, EnumProc, FetchProp, OpenIcon, PaintViewer, SaveViewer, SetNewVersion], ViewerTools USING [MakeNewTextViewer]; PeanutRetrieveImpl: CEDAR MONITOR IMPORTS Atom, BasicTime, Convert, FS, GVRetrieve, IO, MessageWindow, PeanutProfile, PeanutSendMail, PeanutWindow, PrincOpsUtils, Process, PutGet, Rope, TEditDisplay, TextEdit, TextNode, TiogaFileOps, TiogaMenuOps, TiogaOps, UserCredentials, ViewerEvents, ViewerOps, ViewerTools EXPORTS PeanutRetrieve = BEGIN ROPE: TYPE = Rope.ROPE; Viewer: TYPE = ViewerClasses.Viewer; RName: TYPE = GVBasics.RName; TiogaCTRL: GVBasics.ItemType = LOOPHOLE[1013B]; -- an item containing tioga formatting ReportRope: PROCEDURE [r: ROPE] = { PeanutWindow.OutputRope[r] }; GetNewMsgs: PUBLIC ENTRY PROC [open: BOOL _ TRUE] = { ENABLE UNWIND => NULL; [] _ InternalGetNewMsgs[open]; }; peanutProp: ATOM = $PeanutMailFileName; SetMailFileName: PROC[v: Viewer, name: ROPE] = { ViewerOps.AddProp[viewer: v, prop: peanutProp, val: name]; }; GetMailFileName: PROC[v: Viewer] RETURNS[ROPE] = { WITH ViewerOps.FetchProp[viewer: v, prop: peanutProp] SELECT FROM rope: ROPE => RETURN[rope]; ENDCASE => RETURN[NIL]; }; FindMailViewer: PUBLIC PROC[name: ROPE] RETURNS[viewer: Viewer _ NIL] = { Test: ViewerOps.EnumProc -- PROC[v: Viewer] RETURNS[continue: BOOL _ TRUE] -- = { rope: ROPE = GetMailFileName[v]; IF rope#NIL AND Rope.Equal[rope, name, FALSE] THEN { viewer _ v; RETURN[FALSE] }; }; ViewerOps.EnumerateViewers[Test]; }; GetMailViewer: PUBLIC ENTRY PROC[name: ROPE] RETURNS [mailViewer: Viewer] = { ENABLE UNWIND => NULL; mailViewer _ InternalGetMailViewer[name]; }; MakeMailDoc: PROC[fileName: ROPE] RETURNS[mailDoc: TextNode.Ref] = { styleProp: ROPE = "(mail) style"; mailDoc _ TextEdit.DocFromNode[TextEdit.FromRope[fileName]]; TRUSTED { TiogaOps.PutProp[LOOPHOLE[mailDoc], $Prefix, styleProp] }; }; InternalGetMailViewer: INTERNAL PROC[name: ROPE] RETURNS[mailViewer: Viewer] = { mailViewer _ FindMailViewer[name]; IF mailViewer=NIL THEN { wDir: ROPE _ PeanutProfile.workingDirectory; shortName: ROPE _ name.Concat[".mail"]; longName: ROPE _ FS.ExpandName[name: shortName, wDir: wDir].fullFName; fileName: ROPE _ longName; mailDoc: TextNode.Ref _ NIL; file: FS.OpenFile _ FS.nullOpenFile; file _ FS.Open[longName ! FS.Error => IF error.code=$unknownFile THEN CONTINUE]; IF file=FS.nullOpenFile THEN { styleProp: ROPE = "(mail) style"; mailDoc _ TextEdit.DocFromNode[TextEdit.FromRope[shortName]]; TRUSTED { TiogaOps.PutProp[LOOPHOLE[mailDoc], $Prefix, styleProp] }; } ELSE { mailDoc _ PutGet.FromFileC[file]; fileName _ FS.GetName[file].fullFName; }; mailViewer _ ViewerTools.MakeNewTextViewer[info: [ name: longName, file: fileName, data: mailDoc, icon: PeanutWindow.messageSetIcon, iconic: TRUE ]]; SetMailFileName[mailViewer, name]; [] _ ViewerEvents.RegisterEventProc[proc: MessageSetHasBeenEdited, event: edit, filter: mailViewer, before: TRUE]; [] _ ViewerEvents.RegisterEventProc[proc: MessageSetHasBeenSaved, event: save, filter: mailViewer, before: FALSE]; TiogaMenuOps.DefaultMenus[mailViewer]; TiogaMenuOps.FirstLevelOnly[mailViewer]; }; }; InternalGetNewMsgs: INTERNAL PROC [open: BOOL _ TRUE] RETURNS [numRetrieved: INT] = { allOK: BOOL_ TRUE; mailViewer: Viewer; firstHeader: TiogaFileOps.Ref; StashNewMessages: PROC [retrieveOK: BOOL] RETURNS[doRemoteFlush: BOOL] = { allOK _ allOK AND retrieveOK; ViewerOps.SaveViewer[mailViewer]; -- doesn't return until the save is complete RETURN[retrieveOK AND flushRemoteMail]; }; mailViewer _ InternalGetMailViewer[PeanutProfile.activeMailFile]; [numRetrieved, firstHeader] _ AddNewMessages[StashNewMessages, mailViewer]; IF numRetrieved = 0 THEN { ReportRope["\nNo messages were retrieved"]; RETURN}; IF mailViewer.iconic AND PeanutProfile.automaticNewMail THEN NULL ELSE TRUSTED { tdd: TEditDocument.TEditDocumentData _ NARROW[mailViewer.data]; TEditDisplay.EstablishLine[tdd, [LOOPHOLE[firstHeader],0]]; ViewerOps.PaintViewer[mailViewer, client] }; IF ~allOK THEN ReportRope["\nSome messages may not have been retrieved"]; IF open AND mailViewer.iconic THEN ViewerOps.OpenIcon[mailViewer]; }; MessageSetHasBeenEdited: PROC[viewer: Viewer, event: ViewerEvents.ViewerEvent, before: BOOL] RETURNS[abort: BOOL _ FALSE] = { IF before THEN { viewer.icon _ PeanutWindow.dirtyMessageSetIcon; IF viewer.iconic THEN ViewerOps.PaintViewer[viewer: viewer, hint: all]; }; }; MessageSetHasBeenSaved: PROC [viewer: Viewer, event: ViewerEvents.ViewerEvent, before: BOOL] RETURNS[abort: BOOL _ FALSE] = { IF NOT before THEN { viewer.icon _ PeanutWindow.messageSetIcon; IF viewer.iconic THEN ViewerOps.PaintViewer[viewer: viewer, hint: all]; }; }; CopyMessages: PUBLIC PROC [to: ROPE, delete: BOOL] = { OPEN TiogaOps; sourceViewer, destViewer: Viewer; destDoc, sourceDoc, destLast, sourceLast, afterSource: Ref; start, end: Location; level: SelectionGrain; caretBefore, pendingDelete: BOOL; lockedPrimary, lockedSecondary, lockedDest, lockedSource: BOOL _ FALSE; TopParent: PROC [node, root: Ref] RETURNS [parent: Ref] = { DO parent _ Parent[node]; IF parent=root THEN RETURN [node]; node _ parent; ENDLOOP }; Cleanup: PROC = { IF lockedPrimary THEN UnlockSel[primary]; IF lockedSecondary THEN UnlockSel[secondary]; IF lockedDest THEN Unlock[destDoc]; IF lockedSource THEN Unlock[sourceDoc]; }; destViewer _ GetMailViewer[to]; LockSel[primary]; lockedPrimary _ TRUE; [sourceViewer, start, end, level, caretBefore, pendingDelete] _ TiogaOps.GetSelection[]; IF sourceViewer=NIL OR sourceViewer.class.flavor#$Text THEN { UnlockSel[primary]; ReportRope["\nSelect message(s)."]; RETURN }; LockSel[secondary]; lockedSecondary _ TRUE; destDoc _ ViewerDoc[destViewer]; Lock[destDoc]; lockedDest _ TRUE; sourceDoc _ ViewerDoc[sourceViewer]; IF sourceDoc#destDoc THEN { Lock[sourceDoc]; lockedSource _ TRUE }; destLast _ LastChild[destDoc]; sourceLast _ TopParent[end.node, sourceDoc]; afterSource _ Next[sourceLast]; SelectBranches[ -- source viewer: sourceViewer, level: branch, caretBefore: FALSE, pendingDelete: delete, which: primary, start: TopParent[start.node, sourceDoc], end: sourceLast]; SelectBranches[ -- destination viewer: destViewer, start: destLast, end: destLast, level: branch, caretBefore: FALSE, pendingDelete: FALSE, which: secondary]; ToSecondary[]; IF ~delete THEN -- restore original selection SetSelection[sourceViewer, start, end, level, caretBefore, pendingDelete, primary] ELSE IF afterSource # NIL THEN SelectPoint[sourceViewer, [afterSource,0], primary] ELSE CancelSelection[primary]; Cleanup[]; ReportRope[IF delete THEN "\nMoved to " ELSE "\nCopied to "]; ReportRope[to]; }; msgPollingInterval: INT_ 300; -- Number of seconds between mailbox polling. flushRemoteMail: BOOLEAN_ TRUE; gvRetrieveHandle: GVRetrieve.Handle_ NIL; -- cookie for receiving messages. OpenConnection: PUBLIC PROC[user: RName] = { CloseConnection[]; NewUser[user] ; }; CloseConnection: PUBLIC PROC[] = { IF gvRetrieveHandle # NIL THEN{ GVRetrieve.Close[gvRetrieveHandle]; gvRetrieveHandle_ NIL}; }; NewUser: PUBLIC PROC[user: RName] = { IF gvRetrieveHandle = NIL THEN gvRetrieveHandle _ GVRetrieve.Create[ msgPollingInterval, WatchMailBox ]; GVRetrieve.NewUser[gvRetrieveHandle, user, UserCredentials.Get[].password ] ; } ; lastStateReported: GVRetrieve.MBXState _ unknown; WatchMailBox: PROC[newState: GVRetrieve.MBXState] = { status: ROPE _ NIL; IF newState = unknown THEN RETURN; PeanutWindow.SetNewMail[newState=notEmpty]; SELECT newState FROM badName => status _ "Your user name is invalid, please log in"; badPwd => status _ "Your password is invalid"; cantAuth => status _ "Can't check your credentials at this time"; userOK => status _ "Your credentials are OK"; allDown, someEmpty, allEmpty, notEmpty => NULL; ENDCASE => status _ "Bad MBXState!"; IF status#NIL THEN { PeanutWindow.OutputRope["\n"]; PeanutWindow.OutputRope[status]; }; IF newState=notEmpty AND lastStateReported#notEmpty AND PeanutProfile.automaticNewMail THEN { mailViewer: Viewer = FindMailViewer[PeanutProfile.activeMailFile]; IF mailViewer=NIL OR mailViewer.iconic THEN TRUSTED{Process.Detach[FORK ReadMail[]]}; }; }; ReadMail: ENTRY PROC = TRUSTED { ENABLE UNWIND => NULL; numRetrieved: INT; Process.SetPriority[Process.priorityBackground]; IF (numRetrieved _ InternalGetNewMsgs[FALSE])=0 THEN RETURN; MessageWindow.Append[IO.PutFR["New mail retrieved: %g", IO.time[]], TRUE]; MessageWindow.Blink[] }; MessageState: TYPE = { noMore, wasArchived, wasDeleted, OK, retrieveFailed } ; AddNewMessages: PUBLIC PROC[ FinishedWithServer: PROC[BOOL] RETURNS[BOOL], mailViewer: Viewer] RETURNS[numRetrieved: INT, firstHeader: TiogaFileOps.Ref] = { serverKnown: BOOLEAN _ FALSE; mailDoc: TiogaOps.Ref _ TiogaOps.ViewerDoc[mailViewer]; IF gvRetrieveHandle = NIL THEN { -- Open the connection if it's closed. gvRetrieveHandle _ GVRetrieve.Create[ msgPollingInterval, WatchMailBox ] ; GVRetrieve.NewUser[gvRetrieveHandle, PeanutSendMail.userRName, UserCredentials.Get[].password]; } ; SELECT gvRetrieveHandle.MailboxState[] FROM badName, badPwd => GOTO credentialsError; cantAuth => GOTO noServers; ENDCASE; --ok to try numRetrieved_ 0; ReportRope[IO.PutFR["\nCheck for new mail: %g", IO.time[]]]; DO -- Loops over servers. m, formatting: ROPE; messageState: MessageState; timeStamp: GVBasics.Timestamp; gvSender: RName; messages: CARDINAL _ 0; -- the number of messages read from server. archivedReported: BOOLEAN _ FALSE; -- seen an archived message? noMore: BOOLEAN; -- TRUE if no more servers. serverState: GVRetrieve.ServerState; -- The state of the server. headerNode: TiogaFileOps.Ref; serverName: ROPE ; TRUSTED {headerNode _ LOOPHOLE[TiogaOps.LastChild[mailDoc]]}; [noMore, serverState] _ gvRetrieveHandle.NextServer[]; IF noMore THEN EXIT; -- Last server? Then done. serverKnown _ TRUE; serverName _ gvRetrieveHandle.ServerName[]; ReportRope["\n"]; ReportRope[serverName]; ReportRope[": "]; IF serverState # notEmpty THEN { IF serverState = empty THEN ReportRope["empty"] ELSE ReportRope["didn't respond"] ; LOOP; -- Skip to the next server. }; TiogaOps.Lock[mailDoc]; DO ENABLE UNWIND => TiogaOps.Unlock[mailDoc]; [messageState, m, formatting, timeStamp, gvSender] _ ReadMessageRecord[] ; SELECT messageState FROM noMore => EXIT ; wasArchived => IF NOT archivedReported THEN { archivedReported _ TRUE; ReportRope["(archived messages exist)"]}; OK => NULL; wasDeleted => NULL; retrieveFailed => EXIT; ENDCASE => ERROR; IF NOT (messageState = wasDeleted) THEN { DeleteTrailingCRs: PROC [m: ROPE] RETURNS [ROPE] = { len: INT _ Rope.Size[m]; WHILE len > 0 AND Rope.Fetch[m, len-1] = '\n DO len _ len-1; ENDLOOP; RETURN [Rope.Substr[m,0,len]] }; GetField: PROC[message, fieldName: ROPE] RETURNS[contents: ROPE] = { start: INT _ 0; DO cr: INT ~ Rope.Index[s1: message, pos1: start, s2: "\n"]; IF cr=start THEN EXIT; IF Rope.Find[s1: message, s2: fieldName, pos1: start, case: FALSE]=start THEN { i: INT _ start+Rope.Length[fieldName]; IF Rope.Fetch[message, i]=': THEN { i _ i+1; IF Rope.Fetch[message, i]=' THEN i _ i+1; RETURN[Rope.Substr[message, i, cr-i]]; }; }; start _ cr+1; ENDLOOP; RETURN[NIL]; }; GetFieldContents: PROC [name: ROPE, maxLen: INT] RETURNS [ROPE] = { contents: ROPE ~ GetField[m, name]; len: INT ~ Rope.Length[contents]; IF len=0 THEN RETURN["?"] ELSE IF len<=maxLen THEN RETURN[contents] ELSE RETURN[Rope.Concat[Rope.Substr[base: contents, len: maxLen-3], "..."]] }; GetDateFromGMT: PROC[time: BasicTime.GMT] RETURNS[ROPE] = { unpacked: BasicTime.Unpacked = BasicTime.Unpack[time]; day: NAT = unpacked.day; month: ROPE = Convert.RopeFromUnpackedTime[unpacked, months, months]; year: NAT = unpacked.year; RETURN[IO.PutFR["%2g-%g-%02g", IO.int[day], IO.rope[month.Substr[len: 3]], IO.int[year MOD 100]]]; }; headerDate, headerName, headerSubject, header: ROPE; messageNode: TiogaFileOps.Ref; headerNode _ TiogaFileOps.InsertNode[headerNode, FALSE]; IF firstHeader=NIL THEN firstHeader _ headerNode; TiogaFileOps.SetFormat[headerNode, "header"]; headerDate _ GetDateFromGMT[BasicTime.FromPupTime[timeStamp.time]]; IF Rope.Equal[gvSender, PeanutSendMail.userRName, FALSE] OR Rope.Equal[gvSender, PeanutSendMail.simpleUserName, FALSE] THEN headerName _ Rope.Concat["To: ", GetFieldContents["To", 15]] ELSE headerName _ gvSender; headerSubject _ GetFieldContents["Subject", 45]; header _ Rope.Cat["\t", headerDate, "\t", headerName, "\t", headerSubject]; TiogaFileOps.SetContents[headerNode, header]; IF formatting=NIL THEN { messageNode _ TiogaFileOps.InsertNode[headerNode, TRUE]; TiogaFileOps.SetContents[messageNode, DeleteTrailingCRs[m]] } ELSE { messageRoot, messageFirst, messageLast, headerN: TextNode.Ref; messageRoot _ PutGet.FromRope[Rope.Cat[Rope.FromChar['\n],m,formatting]]; messageFirst _ TextNode.FirstChild[messageRoot]; TRUSTED { headerN _ LOOPHOLE[headerNode] }; headerN.child _ messageFirst; messageLast _ TextNode.LastSibling[messageFirst]; messageLast.last _ TRUE; messageLast.next _ headerN; messageRoot.child _ NIL; messageRoot.props _ NIL; }; ViewerOps.SetNewVersion[mailViewer]; ReportRope["."]; messages _ messages + 1; }; ENDLOOP ; -- Finished reading messages from this server. TiogaOps.Unlock[mailDoc]; IF FinishedWithServer[messageState#retrieveFailed] THEN gvRetrieveHandle.Accept[ ! GVRetrieve.Failed => {ReportRope["\nFlush of remote messages failed; you may get these messages again"]; CONTINUE}]; IF messageState#retrieveFailed THEN ReportRope[ IO.PutFR[": retrieved %g messages.", IO.int[messages] ]]; numRetrieved_ numRetrieved + messages; ENDLOOP ; -- End of servers loop, exit. IF NOT serverKnown THEN GOTO noMailboxes; EXITS -- The error reporter for this routine. noMailboxes => ReportRope[" No mail boxes"]; credentialsError => ReportRope[" Credentials error"]; noServers => ReportRope[" No servers responding"]; }; ReadMessageRecord: PROC RETURNS [messageState: MessageState, m, formatting: ROPE, timeStamp: GVBasics.Timestamp, gvSender: RName] = { ENABLE GVRetrieve.Failed --[why: FailureReason, text: ROPE]-- => { ReportRope[SELECT why FROM communicationFailure => "Communication failure", noSuchServer => "No such server", connectionRejected => "Connection rejected", badCredentials => "Bad credentials", unknownFailure => "Unknown failure", ENDCASE => "Undefined error"]; IF text.Size[]>0 THEN { ReportRope[" -- "]; ReportRope[text] }; GOTO gvFailed; }; msgExists, archived, deleted: BOOLEAN; item: GVBasics.ItemHeader; blockSize: NAT = 500; block: REF TEXT _ NIL; m _ NIL; [msgExists, archived, deleted] _ GVRetrieve.NextMessage[ gvRetrieveHandle ]; IF archived THEN messageState _ wasArchived ELSE messageState_ OK; IF deleted THEN { messageState _ wasDeleted; RETURN}; IF NOT msgExists THEN { messageState _ noMore; RETURN}; [timeStamp, gvSender, ] _ GVRetrieve.StartMessage[ gvRetrieveHandle ] ; DO ReadItem: PROC[h: GVRetrieve.Handle] RETURNS[rope: ROPE _ NIL] = { stream: IO.STREAM = GVRetrieve.GetItem[h]; IF block=NIL THEN block _ NEW[TEXT[blockSize]]; WHILE stream.GetBlock[block]>0 DO rope _ rope.Concat[Rope.FromRefText[block]]; ENDLOOP; }; item _ GVRetrieve.NextItem[gvRetrieveHandle]; SELECT item.type FROM PostMark => ERROR; Sender => ERROR; ReturnTo => ERROR; Recipients => NULL; Text => m _ ReadItem[gvRetrieveHandle]; TiogaCTRL => formatting _ ReadItem[gvRetrieveHandle]; Capability => NULL; Audio => NULL; updateItem => NULL; reMail => NULL; LastItem => EXIT; ENDCASE => LOOP; ENDLOOP; EXITS gvFailed => messageState_ retrieveFailed; } ; END. fPeanutRetrieveImpl.mesa Copyright (C) 1983, 1984, 1985 Xerox Corporation. All rights reserved. Created by Paxton, April 1, 1983 2:17 pm Last edited by Bill Paxton, May 12, 1983 4:11 pm Last edited by: Pausch, July 14, 1983 3:26 pm Doug Wyatt, January 18, 1985 10:53:10 am PST ************************************************************************ Enumerate top level viewers, looking for one with a matching $PeanutMailFile property Make this an entry so don't have two Get's at once for same mail file reads any new mail don't do remote flush if ~retrieveOK *********************************************************************** *********************************************************************** This establishes a retrieve connection, and sets up a Mail Polling proc This closes the connection, and invalidates the connection handle. Establish a new user on this connection. This is called when the condition of the mailbox changes OldWatchMailBox: PROC[newState: GVRetrieve.MBXState] = { This is called when the condition of the mailbox changes ActiveMailFileNotOpen: PROC RETURNS [BOOL] = { mailViewer: Viewer = FindMailViewer[PeanutProfile.activeMailFile]; RETURN [mailViewer=NIL OR mailViewer.iconic] }; showTime: BOOL_ TRUE; status: ROPE; IF newState = unknown THEN RETURN; IF (lastStateReported = notEmpty) AND (newState = someEmpty OR newState = allEmpty) THEN { status_ NIL; PeanutWindow.SetNewMail[FALSE] } ELSE SELECT newState FROM badName => {status_ "\nYour user name is invalid, please log in"; showTime_ FALSE}; badPwd => {status_ "\nYour password is invalid"; showTime_ FALSE}; cantAuth => {status_ "\nCan't check your credentials at this time"; showTime_ FALSE}; userOK => {status_ "\nYour credentials are OK"; showTime_ FALSE}; allDown => status_ "\nAll of the mail servers are down"; someEmpty => status_ "\nAll of the mail servers checked are empty"; allEmpty => {status_ NIL; PeanutWindow.SetNewMail[FALSE]}; notEmpty => {status_ NIL; PeanutWindow.SetNewMail[TRUE]; IF lastStateReported#notEmpty AND PeanutProfile.automaticNewMail AND ActiveMailFileNotOpen[] THEN TRUSTED {Process.Detach[FORK ReadMail[]]} }; ENDCASE => status_ "\nBad State!"; lastStateReported _ newState; IF status # NIL THEN { ReportRope[status]; IF showTime THEN ReportRope[IO.PutFR[" at %g", IO.time[]]]; }; }; * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * This is the routine that actually reads the mail & makes the log entry. It calls FinishedWithServer to commit the log before it flushes any particular mail server. Cycle through the servers, until you find one that has mail. If it has mail, then go for it. Step through the servers. Returns a string of the form dd-mmm-yy (for example, 17-Nov-83) Restore leading CR. Get back a root node. Clear out the links from the messageRoot to help garbage collection. Flush the mailbox if desired, we've stashed the messages. This routine reads the messages on this connection, returning messageState = noMore when there aren't any more. Now read all the items in the message, terminating on the LastItem, and skipping the ones that we're not yet interested in. Κ6˜Jšœ™šœG™GJšœ(™(J™0Jšœ-™-J™,—J˜šΟk ˜ Jšœœ"˜,Jšœ œœ˜:Jšœœ˜%Jšœœ<˜DJšœ œ*˜8Jšœ œ˜­Jšœœœ˜4Jšœœ˜$Jšœœ6˜IJšœœ˜Jšœœ˜1Jšœ œ?˜QJšœœΟc ˜8Jšœœ+˜8Jšœœ˜#JšœœIœ˜gJšœ œ˜#Jšœœ˜(Jšœ œ˜'Jšœ œ ˜.Jšœ œ+˜=Jšœ œ ˜2Jšœ œΗ˜ΥJšœœ˜Jšœœ˜#Jšœ œ"˜4Jšœ œd˜sJšœ œ˜&J˜—Jšœ ˜!Jšœœœα˜•Jšœ˜Jšœ˜J˜JšœH™HJšœœœ˜Jšœœ˜$Jšœœ˜J˜Jšœœ ž&˜VJ˜JšΟn œ œœ#˜AJ˜š Ÿ œœœœœœ˜3Jšœœœœ#˜:J˜—Jšœ œ˜'J˜šŸœœœ˜0Jšœ:˜:J˜J˜—šŸœœ œœ˜2šœ2œ˜AJšœœœ˜Jšœœœ˜—J˜J˜—š Ÿœœœœœœ˜IJšœU™Ušœž4œ˜QJšœœ˜ Jšœœœœœœœ˜QJ˜—J˜!J˜J˜—š Ÿ œœ œœœ˜MJ™EJšœœœ˜Jšœ)˜)J˜J˜—šŸ œœ œœ˜DJšœ œ˜!Jšœ<˜œ™EJšœOœ™VJšœ=œ™DJ™:J™CJšœœœ™;šœœœ™9Jšœœ™@Jšœœœœ ™JJšœ™—Jšœ™$—J™šœ œœ™Jšœ™Jšœ œ œœ ™;J™—Jšœ™J™—šŸœœœœ˜ Jšœœœ˜Jšœœ˜Jšœ0˜0Jšœ$œœœ˜J˜ ——J˜J˜—šœ!˜+Jšœœ˜)Jšœ œ ˜Jšœž ˜J˜—J˜J˜šœ œ$œ ˜=J˜—šœž˜Jšœœ˜J˜J˜J˜Jšœ œž+˜EJšœœœž˜@J˜Jšœ<™˜IJ™*—J˜0Jšœ œ˜+Jšœ˜Jšœ1˜1Jšœœ˜4šœœœ˜1J™D—J˜—J˜$J˜J˜J˜—Jšœž.˜8—J˜J™Jšœ9™9šœ1˜7˜/˜SJšœ˜ ———šœœ ˜/Jšœ#œ˜9—J˜&Jšœž˜'—J˜Jšœœ œœ ˜)J˜šœž'˜.J˜,J˜5J˜2—J˜J˜—šŸœœ˜Jšœ,œ˜1Jšœ3˜3JšœS™SJšœ™šœž$œ˜Bšœ œ˜J˜0J˜!J˜,J˜$J˜$Jšœ˜—Jšœœ*˜?Jšœ˜J˜J˜—Jšœœ˜&J˜Jšœ œ˜Jšœœœœ˜Jšœœ˜J˜J˜LJ˜Jšœ œœœ˜BJšœ œœ˜5Jšœœ œœ˜7J˜JšœG™GJšœ3™3—˜J˜Gš˜š Ÿœœœœœ˜BJšœœœ˜*Jš œœœ œœ ˜/šœ˜!J˜,Jšœ˜—J˜—J˜-šœ ˜Jšœœ˜Jšœœ˜Jšœœ˜Jšœœ˜J˜-J˜6Jšœœ˜Jšœœ˜Jšœœ˜Jšœœ˜Jšœœ˜Jšœœ˜—Jšœ˜—š˜J˜)—J˜—J˜Jšœ˜J˜J˜—…—Cc΄