// FtpServProtMail.bcpl - MTP server commands // Copyright Xerox Corporation 1979, 1980, 1981 // Last modified December 8, 1981 6:07 PM by Boggs get "FtpProt.decl" external [ // outgoing procedures ServStoreMail; ServRetrieveMail // incoming procedures GetCommand; FTPM; ServProtocolError FreePList; ScanPList; GeneratePList // incoming statics CtxRunning ] //--------------------------------------------------------------------------- let ServStoreMail() be //--------------------------------------------------------------------------- [ let ok = false [ let ec = nil; let pl = ScanPList(lv ec) if ec eq 0 then ok = (CtxRunning>>FtpCtx.StoreMail)(pl) if pl eq 0 break FreePList(pl) ] repeatwhile ok if ok then [ FTPM(markYes, 0, "Ready for mail") switchon GetCommand()<>FtpCtx.StoreMailMessage)() switchon GetCommand()<>FtpCtx.StoreMailCleanup)(ok) ] //--------------------------------------------------------------------------- and ServRetrieveMail() be //--------------------------------------------------------------------------- //if FtpCtx.RetrieveMail returns false or -1 then // it will never again be called (0 means a markNo was sent, -1 means done) //if FtpCtx.RetrieveMail returns a PList then // FtpCtx.RetrieveMailMessage MAY OR MAY NOT be called // but FtpCtx.RetrieveMailCleanup will ALWAYS be called [ let remotePList = ScanPList(); if remotePList eq 0 return let localPList, ok = 0, nil [ localPList = (CtxRunning>>FtpCtx.RetrieveMail)(remotePList, localPList) if localPList eq 0 % localPList eq -1 then [ ok = localPList; break ] FTPM(markHereIsPList) GeneratePList(localPList) ok = (CtxRunning>>FtpCtx.RetrieveMailMessage)(remotePList, localPList) ] repeatwhile ok if ok then [ FTPM(markYes, 0, "Transfer complete") switchon GetCommand()<>FtpCtx.RetrieveMailCleanup)(remotePList, ok) if ok & ok1 then FTPM(markYes, 0, "MailBox Flushed") FreePList(remotePList) ]