DIRECTORY IO USING [STREAM], MSBasics USING [BodyPartInfo, CHName, Envelope], Rope USING [ROPE]; MSRetrieve: CEDAR DEFINITIONS ~ BEGIN STREAM: TYPE ~ IO.STREAM; ROPE: TYPE ~ Rope.ROPE; Handle: TYPE = REF; ChangeReportProc: TYPE = PROC [state: MboxState, handle: Handle]; Create: PROC [pollingInterval: CARDINAL, reportChanges: ChangeReportProc ฌ NIL] RETURNS [Handle]; Close: PROC [handle: Handle]; NewUser: PROC [handle: Handle, user: MSBasics.CHName, password: ROPE]; MboxState: TYPE = { unknown, badName, badPwd, cantAuth, userOK, allDown, someEmpty, allEmpty, notEmpty }; MailboxState: PROC [handle: Handle] RETURNS [state: MboxState]; FailureReason: TYPE = ATOM; Failed: ERROR [why: FailureReason, text: ROPE]; ServerState: TYPE = { unknown, empty, notEmpty }; NextServer: PROC [handle: Handle] RETURNS [noMore: BOOLEAN, state: ServerState]; ServerName: PROC [handle: Handle] RETURNS [serverName: MSBasics.CHName]; NextMessage: PROC [handle: Handle] RETURNS [msgExists, previouslyRead: BOOLEAN]; GetMessageEnvelope: PROC [handle: Handle] RETURNS [envelope: MSBasics.Envelope]; NextBodyPart: PROC [handle: Handle] RETURNS [MSBasics.BodyPartInfo]; GetBodyPart: PROC [handle: Handle] RETURNS [STREAM]; GetBodyPartAsRope: PROC [handle: Handle] RETURNS [ROPE]; GetBodyPartViaCallback: PROC [handle: Handle, proc: GetBodyPartCallback]; GetBodyPartCallback: TYPE ~ PROC [s: STREAM, checkAbort: PROC RETURNS [BOOL]] RETURNS [abort: BOOL]; MarkMessage: PROC [handle: Handle]; DeleteMessage: PROC [handle: Handle]; Accept: PROC [handle: Handle]; END. ถ MSRetrieve.mesa Copyright ำ 1988, 1991 by Xerox Corporation. All rights reserved. Doug Terry, November 29, 1988 8:40:49 pm PST Wes Irish, December 22, 1988 3:20:06 pm PST Operations for retrieval of electronic mail messages. Handles This interface is intended to be able to be used by multiple clients. They are distinguished by a "handle", created by "Create" and destroyed by the garbage collector. "Close" should be called when you're finished with the handle as a hint to release resources. Must be called before any other entries in this interface. Can be called many times. "pollingInterval" is the interval in seconds to wait between successive inbox checks and "reportChanges" (if provided) is called whenever the state of the user's authentication or mailboxes changes; "reportChanges" will not be called if the state changes to "unknown" or "userOK". Releases resources used by this handle. Further use of this handle is illegal. Authentication and Mailbox Polling Provides new user name and password, and starts authentication and mailbox checking. Records current state of the user's mailboxes. Initially "unknown". Set to "badName", "badPwd", "cantAuth" or "userOK" after authentication check. Set to "allDown", "someEmpty", "allEmpty", or "notEmpty" after mail polling is complete. "someEmpty" means not all servers replied and none had mail; "allEmpty" means all replied and none had mail; "notEmpty" means at least one has mail; "allDown" means none replied. Returns the current mailbox state. Access to Mailboxes The user has a number of mailboxes, each of which is on a XNS mail server. To access all of a client's mail, call "NextServer" repeatedly until it returns noMore=TRUE. For each successful call of "NextServer", if the ServerState is "notEmpty" use the mailbox access procedures to read the mail in the mailbox (otherwise there is no point in using the mailbox access procedures, since the mailbox is either empty or inaccessible). To read the mail in the mailbox, call "NextMessage" until it returns msgExists=FALSE. While accessing a mailbox, "Failed" may be signalled at any time if the communication system fails (because of network or server error). "NextBodyPart" may be called to access in sequence the body parts which are the contents of the message. Note that the BodyPartInfo contains the body part type and length in bytes. The message body is followed by a body part of type "lastBodyPart". Within a body part, an IO.STREAM may be used to access the data of the body part. EndOf[] will be true at the end of the body part. Calling NextBodyPart closes any IO.STREAM on a current body part (even if the entire body part has not been read yet) and moves on to the next body part. At any time within a message, you may call "NextMessage" to skip the remainder of this message. At any time within a mailbox, you may call "Accept". This terminates reading the mailbox and deletes all messages from the mailbox. Calling "accept" will not delete any messages which you haven't been given a chance to read. No other operations on the mailbox are allowed after calling "accept". If you call "NextServer" without having called "accept", the mailbox is closed (if necessary) without deleting the messages (except those which were deleted by calling "deleteMessage"). One of: $RPC -- communication problems $Authentication -- bad credentials or authentication service unavailable $Service -- mail service is busy, unavailable, etc. $Protocol -- protocol used improperly, undoubtedly due to an implemementation bug in MSRetrieveImpl May be signalled by any of the procedures that handle messages. Returns information about the next server in the mailbox site list of the user, and that server becomes the "current server". If there is no such server, noMore=TRUE, in which case the next call to "NextServer" will start a new sequence of mail retrieval. If the state is "unknown", attempting to access the mailbox is inadvisable, as the server is probably down. If the state is "empty", there may in fact be mail, as the state is only a hint obtained by polling. Provides the name of the current server. Returns information about the next message in the mailbox, and that message becomes the "current message". If there is no such message, msgExists=FALSE. If previouslyRead=TRUE then the message is not new, i.e. it has been marked as being read. Retrieves the message's postmark, msgID, sender, etc. Skips the remainder of any previous body part, then delivers information about the next body part. Provides an IO stream for reading the current body part. Provides the current bodyPart as a ROPE. This is probably the most convenient and possible even the most efficient way to get the contents of an item for small to moderate sized items. It is perfectly acceptable for clients to get items solely through this call. Provides the current bodyPart via a callback. This is probably the most efficient for LARGE items and/or items that the client is putting directly to disk, the network, etc. This is the type of PROC that you must provide to GetItemViaCallback. "s" is the STREAM from which you can read the item. You can/should occasionally call "checkAbort" to see if the server wants to abort the transfer. "checkAbort" will RETURN TRUE if it would like you to abort the transfer. You should return abort=TRUE IFF you aborted reading the stream for some reason. Marks current message as being read. Deletes current message. Flushes the mailbox entirely (and irrecoverably). สๅ•NewlineDelimiter –(cedarcode) style™codešœ™Kšœ ฯeœ7™BK™,K™+—K˜Kšœ5™5K™šฯk ˜ Kšžœžœžœ˜Kšœ žœ"˜0Kšœžœžœ˜—K˜Kšะbl œžœž ˜Kšœž˜K˜Kšžœžœžœžœ˜Kšžœžœžœ˜K˜head™šœžœžœ˜Kšœ†ฯc™‡—K˜Kšœžœžœ$˜AK˜š ฯnœžœžœ$žœžœ ˜aKšœ๑™๑K˜—šกœžœ˜KšœO™OK˜——šœ"™"šกœžœ3žœ˜FKšœT™TK˜K˜—šœ žœZ˜iKšœฆ™ฆK˜—šก œžœžœ˜?Kšœ"™"K˜——šœ™Kšœฏ™ฏK˜Kšœ฿™฿K˜Kšœ›™›K˜Kšœ_™_K˜Kšœๅ™ๅK˜K˜šœžœžœ˜™Kšœ™KšœH™HK™4K™d——K˜šกœžœžœ˜/Kšœ?™?K˜—K˜šœ žœ ˜1K˜—šก œžœžœ žœ˜PKšœิ™ิK˜—šก œžœžœ˜HKšœ(™(K˜—šก œžœžœžœ˜PKšœ๖™๖K˜—šกœžœžœ˜PKšœ5™5K˜—šก œžœžœ˜DKšœb™b—K˜šก œžœžœžœ˜4Kšœ8™8K™—šกœžœžœžœ˜8Kšœˆ™ˆK™—šกœžœ-˜IKšœฎ™ฎK˜—šœžœžœžœžœžœžœžœ žœ˜dKšœE™EKšœ3™3Kšœช™ชKšœP™PK˜—K˜šก œžœ˜#K™$—K˜šก œžœ˜%K™—K˜šกœžœ˜Kšœ1™1—K˜—Kšžœ˜—…—,ว