MSUtils.mesa
Copyright Ó 1988, 1989, 1990, 1991 by Xerox Corporation. All rights reserved.
Wes Irish, December 22, 1988 6:22:34 pm PST
Willie-Sue, July 27, 1990 4:31:59 pm PDT
Utilities for manipulating MS stuff...
~
BEGIN
OPEN
EnvelopeFormat: EnvelopeFormatP1517V1,
MailFormat: MailFormatP1516V3,
MailTransport: MailTransportP17V5;
ROPE: TYPE ~ Rope.ROPE;
NameBodyPairList: TYPE = LIST OF NameBodyPair;
NameBodyPair:
TYPE =
RECORD [
fieldName: ROPE,
fieldBody: ROPE
];
HeaderFromText:
PROC
[text:
ROPE, includeTextAnnotation:
BOOL ¬
TRUE, plainText, formatting:
ROPE]
RETURNS [
header: ROPE,
errorCode: MailParse.ParseErrorCode ¬ none,
index: INT ¬ 0,
included: NameBodyPairList,
notIncluded: NameBodyPairList];
Takes an 822-like header as "text" and converts it into an encoded representation "header" that can be handed to MSSend as the header BodyPart. "text" may actually be a header followed by a message body; the two being delimited by the 822 standard "double-carriage-return".
If "includeTextAnnotation"=TRUE then any input fields that are unknow will be included in the TextAnnotation attribute in the resulting header. (Currently the encoded TextAnnotation attribute is limited in the spec to 2000 characters. Only entire fields will be added to the TextAnnotation attribute. Once TextAnnotation is full additional fields that normally would have been put into TextAnnotation will simply be added to the notIncluded list, see below)
"errorCode" indicates success or the particular problem encountered.
If "errorCode" indicates a problem
then "index" will point close to the location of the problem
else "index" points just past the header. If "text" also included a message body then Rope.Substr[base: text, start: index] will be the portion of the message that should be sent as the message body.
"included" is a list of those fields that were successfully encoded into "header"
"notIncluded" is a list of those fields that were not successfully encoded into "header".
XNSRNameFromRope:
PROC [name:
ROPE]
RETURNS [rName: MSBasics.RName];
"name" should be a rope representing an NS name.
Returns a valid MSBasics.RName for "name".
StrippedName:
PROC [name, domain, organization:
ROPE]
RETURNS [stripped:
ROPE];
If name is not fully qualified, it uses domain & organization to qualify the name, then strips off {organization, domain} if they match the local, i.e., current {organization, domain}.
ParseEnvelope:
PROC [envelope: MailTransport.Envelope]
RETURNS [parsed: MSBasics.Envelope];
Converts the encoded form of an envelope to a decoded RECORD form.
SystemMessageFromEnvelope:
PROC [envelope: MSBasics.Envelope]
RETURNS [msg:
ROPE];
Creates a "system message" from the envelope if appropriate. If no "system message" is appropriate then NIL will be returned. A "system message" is a text message and is a way of conveying otherwise encoded or hidden information to the user. The current use is for conveying report information to the user that would otherwise only be present in the envelope, which usually isn't displayed.
Straightforward RopeFromMumble conversion routines:
RopeFromMSRName: PROC [name: MSBasics.RName] RETURNS [rope: ROPE];
RopeFromPostmark: PROC [postmark: MSBasics.Postmark] RETURNS [rope: ROPE];
RopeFromContentsType:
PROC[contentsType: MSBasics.ContentsType]
RETURNS [rope:
ROPE];
RopeFromPriority: PROC [priority: MSBasics.Priority] RETURNS [rope: ROPE];
RopeFromAuthenticationLevel: PROC [authLevel: MSBasics.AuthenticationLevelOfSender]
RETURNS [rope: ROPE];
RopeFromBodyPartType: PROC [bodyPartType: MailTransport.BodyPartType]
RETURNS [rope: ROPE];
RopeFromTOC: PROC [toc: MSBasics.TableOfContents] RETURNS [rope: ROPE];
RopeFromConvertedItem:
PUBLIC
PROC [item: EnvelopeFormat.ConvertedItem]
RETURNS [rope:
ROPE];
RopeFromConverted: PROC [converted: MSBasics.Converted] RETURNS [rope: ROPE];
RopeFromEnvelope:
PROC [envelope: MSBasics.Envelope, newLines:
BOOL ¬
TRUE, indentation:
ROPE ¬
NIL]
RETURNS [
ROPE];
If newLines=TRUE then each envelope item will be on its own line with "indentation" at the begining of the line. indentation=NIL produces a rope that looks like an 822 header.
If newLines=FALSE then each envelope item will be separated by ", " with no CRs. "indentation" is ignored. This is mostly intended for decoding the recursivly enclosed envelope of report items.
RopeFromReport:
PROC [report: MSBasics.Report, newLines:
BOOL ¬
TRUE]
RETURNS [rope:
ROPE];
If newLines=TRUE then the returned rope will look much like an 822 header and is suitable for presentation to the user for inclusion in a message body.
If newLines=FALSE then report information will be separated by ", " with no CRs and is suitable for the body of a single 822 field. This is mostly intended for decoding the recursivly enclosed envelope of report items.
RopeFromMumble Routines for things that are found within a Report. (Are these ever going to be used outside of the implementation module?)
RopeFromReportType:
PROC [reportType: MailTransport.ReportType]
RETURNS [rope:
ROPE];
RopeFromReason:
PROC [reason: EnvelopeFormat.Reason]
RETURNS [rope:
ROPE];
RopeFromDelType:
PROC [delType: EnvelopeFormat.DelType]
RETURNS [rope:
ROPE];
RopeFromNonDelType:
PROC [nonDelType: EnvelopeFormat.NonDelType]
RETURNS [rope:
ROPE];
RopeFromFate:
PROC [fate: EnvelopeFormat.Fate]
RETURNS [rope:
ROPE];
RopeFromRecipient:
PROC [recipient: MSBasics.Recipient]
RETURNS [rope:
ROPE];
RopeFromMessageID:
PROC [msgID: MSBasics.MessageID]
RETURNS [rope:
ROPE];
RopeFromNonDeliveredRecipient:
PROC [recipient: EnvelopeFormat.NonDeliveredRecipient]
RETURNS [rope:
ROPE];
RopeFromDeliveredRecipient:
PROC [recipient: EnvelopeFormat.DeliveredRecipient]
RETURNS [rope:
ROPE];
RopeFromInvalidRecipients:
PROC [recipients: EnvelopeFormat.InvalRecip]
RETURNS [rope:
ROPE];
RopeFromSucList:
PROC [succeeded: EnvelopeFormat.SucList]
RETURNS [rope:
ROPE];
RopeFromFailList:
PROC [failed: EnvelopeFormat.FailList]
RETURNS [rope:
ROPE];
RopeFromRepType: PROC [repType: EnvelopeFormat.RepType] RETURNS [rope: ROPE];