MailUtils.mesa
Copyright Ó 1987, 1989, 1992 by Xerox Corporation. All rights reserved.
Doug Terry, December 12, 1988 5:47:08 pm PST
Willie-sue, December 10, 1991 2:25 pm PST
Utilities for manipulating mail messages, postmarks, recipients, etc.
~
BEGIN
STREAM: TYPE ~ IO.STREAM;
ROPE: TYPE ~ Rope.ROPE;
Credentials: TYPE ~ REF CredentialsRec;
CredentialsRec:
TYPE ~
RECORD [
rName: MailBasics.RName,
password: ROPE
];
UserCredentialsProc: TYPE = PROC RETURNS[creds: Credentials];
LoggedInUserProc:
TYPE =
PROC[creds: Credentials]
RETURNS[yes:
BOOL];
returns TRUE if creds is the loggedIn user for that protocol
LocalNameProc:
TYPE =
PROC[rName: MailBasics.RName]
RETURNS[local:
ROPE];
returns NIL if it doesn't recognize the rName
WhoIsLoggedInProc:
TYPE =
PROC
RETURNS[who: Rope.
ROPE];
in some protocols, the details of the name used to log in may be different from the name needed for retrieving mail (e.g., xns)
RegisterUserCredentialsProc:
PROC[which:
ATOM,
proc: UserCredentialsProc, loggedIn: LoggedInUserProc, local: LocalNameProc,
who: WhoIsLoggedInProc];
GetUserCredentials:
PROC [which:
ATOM ¬
NIL]
RETURNS [creds:
LIST
OF Credentials];
IF which = NIL then returns all the credentials of currently logged-in user, else only the ones asked for - this could return NIL if only $chs is asked for and only $gv credentials exist.
GetLoggedInUser:
PROC[which:
ATOM]
RETURNS[Rope.
ROPE];
IsThisTheLoggedInUser:
PROC [cdL:
LIST
OF Credentials]
RETURNS [yes:
BOOL];
Returns yes: TRUE if cdL is the currently loggedIn User.
LocalNameFromRName: LocalNameProc;
e.g., for grapvevine names, returns the name without registry, for xns names, the object part of the name
GeneratePostmark:
PROC[gmt: BasicTime.
GMT ¬ BasicTime.nullGMT, machine:
ROPE]
RETURNS [ts: MailBasics.Postmark];
Generate a postmark from a message's time (when sent) and machine (where posted or originated); if gmt is BasicTime.nullGMT then BasicTime.Now[] is used.
GetTimeFromPostmark:
PROC [ts: MailBasics.Postmark]
RETURNS [gmt: BasicTime.
GMT];
Gets the time out of the message postmark; if there is an error, earliestGMT is returned.
IsThisAPostmark:
PROC [r:
ROPE]
RETURNS [yes:
BOOL];
Returns TRUE if r has the form of a known MailBasics.Postmark.
RopeFromItemType:
PROC [itemType: MailBasics.ItemType]
RETURNS [rope:
ROPE];
You know...
RopeFromStream: PROC [s: STREAM, maxTextRun: INT ¬ 2048] RETURNS [contents: ROPE];