SendMailOps.mesa - public interface to Mail Sending operations
Copyright Ó 1989, 1992 by Xerox Corporation. All rights reserved.
Willie-Sue on August 8, 1989 3:27:00 pm PDT
Willie-s, December 11, 1991 8:19 pm PST
DIRECTORY
IO USING [STREAM, Value],
MailBasics USING [RNameList],
MailSend USING [SendingCredentialsList],
Menus USING [MenuProc],
Rope USING [ROPE],
TextNode USING [Ref],
ViewerClasses USING [Viewer],
ViewerTools USING [TiogaContents];
SendMailOps: CEDAR DEFINITIONS = BEGIN
ROPE: TYPE = Rope.ROPE;
STREAM: TYPE = IO.STREAM;
Viewer: TYPE = ViewerClasses.Viewer;
Form: TYPE = REF FormRec;
FormRec: TYPE = RECORD[formText: ViewerTools.TiogaContents, fields: LIST OF ROPE ¬ NIL];
FormAttr: TYPE = RECORD[ name: ROPE, val: ROPE ];
defaultText: READONLY ViewerTools.TiogaContents;
answerText: READONLY ViewerTools.TiogaContents;
forwardText: READONLY ViewerTools.TiogaContents;
labelFont: READONLY ROPE;
***********************************************************
OutBoxMsg: TYPE = REF OutBoxMsgRec;
OutBoxMsgRec: TYPE = RECORD[
sentTC, replaceTC: ViewerTools.TiogaContents,
subject: ROPE,
next: OutBoxMsg
];
outBox: OutBoxMsg;
outBoxLength: INT;
userRNameList: READONLY MailBasics.RNameList;
simpleUserNameList: READONLY LIST OF ROPE;
simpleNameListWithoutSpaces: READONLY LIST OF ROPE;
sendingCredentialsList: READONLY MailSend.SendingCredentialsList;
***********************************************************
Dealing with sender viewers and outBox
Send: PROC[v: Viewer, doClose: BOOL ¬ FALSE, transport: ATOM ¬ NIL] RETURNS[sent: BOOL];
is given a text viewer set up for sending; does the sending
SendUnformatted: PROC[v: ViewerClasses.Viewer, doClose: BOOL ¬ FALSE, transport: ATOM ¬ NIL] RETURNS[sent: BOOL];
is given a text viewer set up for sending; does the sending without including formatting
BuildSendViewer: PROC[paint, iconic: BOOL, form: Form ¬ NIL,
who: Viewer ¬ NIL, forceNew: BOOL ¬ FALSE, transport: ATOM ¬ NIL]
RETURNS[v: Viewer, which: ATOM];
builds a sending viewer, possibly reusing an existing clean one, or making a new one if forceNew is TRUE
Answer: PROC[msgHeaders: ROPE, who: Viewer ¬ NIL, which: ATOM ¬ NIL]
RETURNS [v: Viewer];
Forward: PROC[msg: Viewer, who: Viewer ¬ NIL] RETURNS [v: Viewer];
this needs the whole viewer because it's doing a secondary selection on all of it
ReSend: PROC[msg: ViewerClasses.Viewer, who: ViewerClasses.Viewer ¬ NIL]
RETURNS[v: ViewerClasses.Viewer];
expects msg to be a message displayer; changes the Date: field to OriginalDate:; changes the From: field to OriginallyFrom: and puts the updated message into a sender
AppendHeaderLine: PROC[v: Viewer, line: ROPE, changeSelection: BOOL ¬ FALSE];
ClearSendViewer: PROC[v: Viewer];
fills in senderV with the default form
StuffForm: PROC[v: Viewer, contents: ViewerTools.TiogaContents];
displays contents in senderV, grabs focus & selects first placeholder
GetOutBoxMsgForSender: PROC[sender: Viewer] RETURNS[OutBoxMsg];
AddToOutBox: PROC[outBoxMsg: OutBoxMsg];
ChangeOutBoxLength: PROC[new: INT] RETURNS[old: INT];
***********************************************************
RegisterReporter: PROC[strm: STREAM];
allows others to have SendMailTool use its reporting procedure
UnregisterReporter: PROC[strm: STREAM];
SenderReport: PROC[format: ROPE, v1, v2, v3: IO.Value ¬ [null[]], blink: BOOL ¬ FALSE];
AddToSenderProps: PROC[
key: ATOM, proc: PROC[v: Viewer, action: ATOM, ra: REF ANY], data: REF ANY];
does AddProp[sendViewer, key, REF RECORD[proc, data]] to subsequent senders
RemoveFromSenderProps: PROC[key: ATOM];
removes key from list of senderProps
AddToSendMenu: PROC[label: ROPE, proc: Menus.MenuProc];
adds a menu button to the sender's menu
RemoveFromSendMenu: PROC[name: ROPE];
removes the named button from the sender menu, if such a button exists; no errors
ReplaceInSendMenu: PROC[label: ROPE, proc: Menus.MenuProc] RETURNS[oldFound: BOOL];
if label is found, replace it; otherwise add it and return FALSE
GetFieldBody: PROC[text, fieldName: ROPE] RETURNS[fieldBody: ROPE];
expects text to be the text of a message; parses the header fields looking for a field named fieldName and returns the value of the fieldBody, or NIL if no such fieldName is found.
GetRecipients: PROC[sender: Viewer, transport: ATOM ¬ NIL]
RETURNS[rList: MailBasics.RNameList, parseError: BOOL];
expects sender to contain a message to be sent; will parse the headers and return a list of all the recipients of the message; if an error occurs while parsing the viewer, parseError=TRUE is returned, and the viewer will have the offending field underlined
***********************************************************
CreateSendViewer: PROC[fromExec: BOOL, transport: ATOM ¬ NIL] RETURNS[which: ATOM];
create a viewer for sending msgs; if transport is NIl or $any, use loaded transports, otherwise tries to use the one requested, returns which one it could use
TiogaTextFromStrm: PROC[strm: STREAM, startPos: INT ¬ 0, len: INT ¬ LAST[INT]] RETURNS[contents: ViewerTools.TiogaContents];
returns NIL IF EndOfStream encountered during read
RopeFromStream: PROC [strm: STREAM, startPos: INT ¬ 0, len: INT ¬ LAST[INT]]
RETURNS [ROPE];
Reads len bytes from the given stream, starting at the given start position, although reading will be truncated at the end of stream. A client wishing to check for exactly len bytes being read should check the length of the returned rope. Any signals are passed up to the caller, since they should not really happen.
ChangeUserRNameList: PROC[newUser: MailBasics.RNameList];
used by WalnutMascarade, so one person can scavenge another's mail database
IsThisTheCurrentUser: PROC[who: ROPE] RETURNS[yes: BOOL];
***********************************************************
CreateRopeForTextNode: PROC [doc: TextNode.Ref] RETURNS [ROPE];
This lets you read characters from an arbitrary Tioga doc as if it were a rope.
Returns CR's between nodes.
Use with caution. doc should NOT change during the lifetime of this rope.
GetCRTiogaContents: PROC [viewer: Viewer]
RETURNS [contents: ViewerTools.TiogaContents ¬ NIL];
returns the OldStyle-GetTiogaContents
END.