// IfsMailRes.bcpl -- Mail System RESIDENT code
// Copyright Xerox Corporation 1979
// Last modified April 10, 1980  1:47 AM by Boggs

get "IfsFtpProt.decl"
get "IfsMail.decl"

external
[
// outgoing procedures
MailEvent

// incoming procedures
CreateJob; QueueEvent; MailJob

// incoming statics
mail
]

//----------------------------------------------------------------------------
let MailEvent(ecb) be
//----------------------------------------------------------------------------
[
if mail>>Mail.wake ne 0 then
   mail>>Mail.wake = mail>>Mail.wake -1

if (mail>>Mail.wake eq 0 % mail>>Mail.workToDo ne 0) &
 mail>>Mail.ctx eq 0 & mail>>Mail.enabled ne 0 then
   mail>>Mail.ctx = CreateJob(MailJob, jobTypeMail, lenExtraFtpCtx)

QueueEvent(ecb, eventInterval*100)
]