DIRECTORY CedarSnapshot USING [CheckpointProc, Register, RollbackProc], UserExec USING [CommandProc, RegisterCommand], Process USING [Detach], Menus USING [ClickProc, MenuProc], PeanutSendMail, Spell, Rope, PeanutRetrieve, PeanutWindow, TiogaMenuOps, ViewerClasses, ViewerOps, VirtualDesktops; PeanutTopImpl: CEDAR PROGRAM IMPORTS PeanutWindow, PeanutRetrieve, PeanutSendMail, CedarSnapshot, Process, Spell, Rope, UserExec, TiogaMenuOps, VirtualDesktops, ViewerOps = BEGIN NewForm: Menus.MenuProc = { PeanutSendMail.NewMsgForm[mouseButton, shift, control] }; AnswerMessage: Menus.MenuProc = { PeanutSendMail.AnswerMsg[mouseButton, shift, control] }; ForwardMessage: Menus.MenuProc = { PeanutSendMail.ForwardMsg[mouseButton, shift, control] }; SendMessage: Menus.MenuProc = { PeanutSendMail.SendMsg[mouseButton, shift, control] }; NewMail: Menus.MenuProc = { PeanutRetrieve.GetNewMsgs[] }; Abort: Menus.MenuProc = { PeanutWindow.abortFlag _ TRUE }; SaveAll: Menus.MenuProc = { files: LIST OF Rope.ROPE _ mailFiles; WHILE files # NIL DO viewer: ViewerClasses.Viewer _ VirtualDesktops.FindViewer[files.first].viewer; IF viewer # NIL AND viewer.newVersion THEN { PeanutWindow.OutputRope["\nSaving "]; PeanutWindow.OutputRope[files.first]; TiogaMenuOps.Save[viewer] }; files _ files.rest; ENDLOOP; }; MailFileButton: Menus.ClickProc = { IF mouseButton=yellow THEN -- open the message file ViewerOps.OpenIcon[PeanutRetrieve.GetMailViewer[NARROW[clientData]]] ELSE PeanutRetrieve.CopyMessages[to: NARROW[clientData], delete: mouseButton=blue] }; restartAfterRollback: BOOL _ FALSE; PeanutCheckpointProc: CedarSnapshot.CheckpointProc = { CloseDown[]; restartAfterRollback _ TRUE }; PeanutRollbackProc: CedarSnapshot.RollbackProc = { IF restartAfterRollback THEN TRUSTED {Process.Detach[FORK StartPeanut[]]}}; BuildPeanut: UserExec.CommandProc = {StartPeanut[]}; CloseDown: PROC = { PeanutRetrieve.CloseConnection[] }; mailFiles: LIST OF Rope.ROPE; modes: REF Spell.ModesRecord _ NEW[Spell.ModesRecord]; StartPeanut: PROC = { files: LIST OF Rope.ROPE; NullInform: Spell.InformProc = {}; AddName: PROC [fileName: Rope.ROPE] = { name: Rope.ROPE _ Rope.Substr[fileName, 0, Rope.Find[fileName, "."]]; PeanutWindow.AddButton[name: name, proc: MailFileButton, data: fileName] }; modes.inform _ modes.confirm _ modes.disabled _ never; modes.timeout _ -1; modes.defaultConfirm _ FALSE; IF PeanutSendMail.AuthenticateUser[] THEN [] _ PeanutRetrieve.NewUser[PeanutSendMail.userRName]; IF PeanutWindow.Create[] THEN { -- created a new one files _ mailFiles _ Spell.GetMatchingFileList[unknown: "*.Mail", modes: modes, inform: NullInform]; WHILE files # NIL DO AddName[files.first]; files _ files.rest; ENDLOOP } ELSE { -- restarting, probably after Rollback; check for new Mail files IsOld: PROC [name: Rope.ROPE] RETURNS [yes: BOOL] = { fileList: LIST OF Rope.ROPE _ mailFiles; WHILE fileList # NIL DO IF Rope.Equal[name, fileList.first] THEN RETURN [TRUE]; fileList _ fileList.rest; ENDLOOP; RETURN [FALSE] }; files _ Spell.GetMatchingFileList[unknown: "*.Mail", modes: modes, inform: NullInform]; WHILE files # NIL DO IF ~IsOld[files.first] THEN { PeanutWindow.Destroy[]; [] _ PeanutWindow.Create[]; files _ mailFiles _ Spell.GetMatchingFileList[unknown: "*.Mail", modes: modes, inform: NullInform]; WHILE files # NIL DO AddName[files.first]; files _ files.rest; ENDLOOP; EXIT }; files _ files.rest; ENDLOOP }; }; PeanutWindow.AddCommand[name: "NewMail", proc: NewMail]; PeanutWindow.AddCommand[name: "NewForm", proc: NewForm]; PeanutWindow.AddCommand[name: "Answer", proc: AnswerMessage]; PeanutWindow.AddCommand[name: "Forward", proc: ForwardMessage]; PeanutWindow.AddCommand[name: "Send", proc: SendMessage]; PeanutWindow.AddCommand[name: "Abort", proc: Abort]; PeanutWindow.AddCommand[name: "SaveAll", proc: SaveAll]; UserExec.RegisterCommand["Peanut", BuildPeanut, "For retrieving and sending mail"]; TRUSTED {CedarSnapshot.Register[c: PeanutCheckpointProc, r: PeanutRollbackProc]}; StartPeanut[]; END. pPeanutTopImpl.mesa; Written by Bill Paxton, February 1983 Last edited by Paxton on April 4, 1983 9:10 am Κi– "Cedar" style˜Iproc– "Cedar" stylešœ9™9Kšœ.™.unitšΟk ˜ Jšœœ*˜=Jšœ œ ˜.Jšœœ ˜Jšœœ˜"Jšœ˜J˜J˜Jšœ˜Jšœ ˜ Jšœ ˜ Jšœ˜Jšœ ˜ Jšœ˜—šœœ˜Jšœˆ˜—Lš˜I modheader˜šœ˜Mšœ9˜9—M˜šœ!˜!Mšœ8˜8—M˜šœ"˜"Mšœ9˜9—M˜šœ˜Mšœ6˜6—M˜šœ˜Mšœ˜—M˜šœ˜Mšœœ˜ —M˜šœ˜Mšœœœœ ˜%šœ œ˜M˜Nšœ œœœ˜,M˜%M˜%M˜—Mšœ˜Mšœ˜—Mšœ˜M˜—šœ#˜#šœœΟc˜3Mšœ0œ˜D—Mšœ!œ*˜U—M˜Mšœœœ˜#šœ6˜6Mšœ$œ˜+—šœ2˜2Mšœœœœ˜KM˜—Jšœ4˜4J˜šΟn œœ˜J˜#—M˜Mšœ œœœ˜šœœœ˜6J˜—šŸ œœ˜Mšœœœœ˜Mšœ"˜"šŸœœœ˜'Mšœ œ6˜EMšœK˜K—M˜6M˜Mšœœ˜šœ#˜)Mšœ6˜6—šœœž˜4šœ˜MšœO˜O—Mšœ œœ+œ˜H—šœž@˜Gš Ÿœœ œœœ˜5Mšœ œœœ ˜(šœ œ˜Mšœ"œœœ˜7Mšœ˜Mšœ˜—Mšœœ˜—MšœW˜Wšœ œ˜šœœ˜Mšœ˜Mšœ˜šœ˜MšœO˜O—Mšœ œœ+œ˜GMšœ˜—Mšœ˜Mšœ˜ ——M˜—M˜Mšœ8˜8Mšœ8˜8Mšœ=˜=Mšœ?˜?Mšœ9˜9Mšœ4˜4Mšœ8˜8J˜J˜SM˜MšœJ˜QM˜M˜M˜Mšœ˜J˜—…—¬