-- File: WalnutSendOps.mesa
-- public interface to Mail Sending operations

-- Created by: Haugeland, August 5, 1983

-- Edited by
Willie-Sue on December 13, 1983 1:58 pm
-- Last Edited by: Donahue, September 2, 1983 9:39 am

DIRECTORY
 BasicTime USING [GMT, nullGMT],
 GVBasics USING [ItemType],
IO USING [STREAM],
 Menus USING [MenuProc],
 Rope USING [ROPE],
 ViewerClasses USING [Viewer],
 ViewerTools USING [TiogaContents];

WalnutSendOps: CEDAR DEFINITIONS =

BEGIN
ROPE: TYPE = Rope.ROPE;
Viewer: TYPE = ViewerClasses.Viewer;
TiogaContents: TYPE = ViewerTools.TiogaContents;

Form: TYPE = REF FormRec;

FormRec: TYPE = RECORD[formText: ViewerTools.TiogaContents, fields: LIST OF ROPENIL];

FormAttr: TYPE = RECORD[ name: ROPE, val: ROPE ];

defaultText: READONLY ViewerTools.TiogaContents;

answerText: READONLY ViewerTools.TiogaContents;

forwardText: READONLY ViewerTools.TiogaContents;

labelFont: READONLY ROPE;

-- ***********************************************************
-- used by various Walnut procs


userRName: READONLY ROPE;
simpleUserName: READONLY ROPE;
defaultRegistry: ROPE;
TiogaCTRL: GVBasics.ItemType;

-- ***********************************************************
-- Sending messages & dealing with sender viewers [WalnutSendCommonImpl]

Send: PROC[v: ViewerClasses.Viewer, doClose: BOOLFALSE] RETURNS[sent: BOOL];
-- is given a text viewer set up for sending; does the sending

BuildSendViewer: PROC[paint, iconic: BOOL, form: Form ← NIL, who: Viewer ← NIL]
   RETURNS[v: Viewer];
-- builds sending viewer

Answer: PROC[msgHeaders: ROPE, who: Viewer← 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

AppendHeaderLine: PROC[v: Viewer, line: ROPE, changeSelection: BOOLFALSE];

ClearSendViewer: PROC[v: Viewer];
-- fills in senderV with the default form

StuffForm: PROC[v: Viewer, contents: TiogaContents];
-- displays contents in senderV, grabs focus & selects first placeholder

RegisterReporter: PROC[strm: IO.STREAM];
-- allows Walnut to have WalnutSend use its reporting procedure

UnregisterReporter: PROC[strm: IO.STREAM];

AddToSendMenu: PROC[label: ROPE, proc: Menus.MenuProc];
-- adds a menu button to the sender's menu

-- ***********************************************************

WalnutSendProc: PROC[fromExec: BOOL];
-- create a viewer for sending msgs

TiogaTextFromStrm: PROC[strm: IO.STREAM, startPos: INT← 0, len: INTLAST[INT]]
RETURNS[contents: TiogaContents];
-- returns NIL IF EndOfStream encountered during read

RFC822Date: PUBLIC PROC[gmt: BasicTime.GMT← BasicTime.nullGMT] RETURNS[date: ROPE];
-- generates arpa standard time, dd mmm yy hh:mm:ss zzz

END.