GVRetrieveInternal.mesa: Private DEFS for mail retrieval
Copyright © 1985 by Xerox Corporation. All rights reserved.
Andrew Birrell June 6, 1983 10:59 am
DIRECTORY
BasicTime USING[ GMT ],
GVBasics USING[ GVString, ItemHeader, Password, RName ],
GVProtocol USING[ Handle ],
GVRetrieve USING[ MBXState, ServerState, ServerType ],
PupDefs USING[ PupAddress ],
PupTypes USING[ Pair ],
Rope USING[ ROPE ];
GVRetrieveInternal: CEDAR DEFINITIONS = BEGIN
The client's mailboxes are represented by a chain:
MBXData: TYPE = RECORD[
next: MBXPtr,
type: GVRetrieve.ServerType,
state: GVRetrieve.ServerState,
addrState: { unknown, known, bad },
replyWanted: BOOLEAN,
addr: PupDefs.PupAddress,
name: GVBasics.RName ];
MBXPtr: TYPE = REF MBXData;
noMBX: MBXPtr = NIL;
The overall state of mail is represented by a HandleObject
Handle: TYPE = REF HandleObject;
HandleObject: TYPE = MONITORED RECORD[
list of the user's mailboxes
MBXChain: MBXPtr,
mbxKnown: BOOLEAN, -- whether user's mailbox sites are known
notEmptyMBXCount: CARDINAL,
unknownMBXCount: CARDINAL,
user's registry type
registry: GVRetrieve.ServerType,
Current state of mail reading:
state: -- position in legal call sequences
{ -- GV states
beforeMBX, beforeTOCr, beforeBody, inBody,
beforeTOCw, afterMessage, afterMBX,
MTP states
end, beginning, message, lastItem, block,
lastBlock, lastMessage },
spareByte: BOOLEAN, -- GV padding, or MTP odd-byte mess
spareByteValue: CHARACTER, -- for MTP odd-byte mess
header: GVBasics.ItemHeader, -- header of current item; length field is decremented as we go
itemLength: INT, -- total length of current item (for IO.GetLength)
currentMBX: MBXPtr, -- mailbox being read
messages: CARDINAL, -- number of messages in the mailbox
currentStr: GVProtocol.Handle, -- stream to mailbox being read
State of mailbox polling:
mbxState: GVRetrieve.MBXState,
polling: BOOLEAN,
pollWanted: BOOLEAN,
newPollWanted: BOOLEAN,
pollReplying: BOOLEAN,
mbxStateChange: CONDITION,
pollCond: CONDITION,
pollID: PupTypes.Pair,
sendPoll: PROCESS,
pollStarted: BasicTime.GMT, -- real time when poll last started
Global information supplied by the client:
interval: INT, -- polling interval, in seconds
changes: PROCEDURE[GVRetrieve.MBXState],
userName: GVBasics.RName,
userPwd: Rope.ROPE,
userKey: GVBasics.Password ];
Interface to mailbox polling: exported by RetrievePoll
SendPollProcess: PROC[handle: Handle];
for forking to
NoteChangedMBX: PROC[handle: Handle, mbx: MBXPtr,
new: GVRetrieve.ServerState];
changes handle.mbxState appropriately to reflect change in the
known state of this mailbox
SetMBXState: PROC[handle: Handle, state: GVRetrieve.MBXState];
changes handle.mbxState to given value.
Interface to obtain new info about user: exported by RetrieveInit
FindRegistryAndMailboxes: PROC[handle: Handle];
determines registry type and mailbox locations
FindAddress: PROC[handle: Handle, mbx: MBXPtr];
attempts to find mailboxes address (which must have been unknown)
ServerAddress: PROC[handle: Handle] RETURNS[ PupDefs.PupAddress];
may signal Failed[communicationError] or Failed[noSuchServer]
Access to individual mailbox
GVClose: PROC[ handle: Handle ];
Close any stream created for this mailbox without deleting messages
Does not complain if there is no stream.
END.