libev smtp migration
[citadel.git] / citadel / modules / smtp / smtpqueue.h
1 /*****************************************************************************/
2 /*               SMTP CLIENT (Queue Management) STUFF                        */
3 /*****************************************************************************/
4
5 #define MaxAttempts 15
6 typedef struct _delivery_attempt {
7         time_t when;
8         time_t retry;
9 }DeliveryAttempt;
10
11 typedef struct _mailq_entry {
12         DeliveryAttempt Attempts[MaxAttempts];
13         int nAttempts;
14         StrBuf *Recipient;
15         StrBuf *StatusMessage;
16         int Status;
17         int n;
18         int Active;
19 }MailQEntry;
20
21 typedef struct queueitem {
22         long MessageID;
23         long QueMsgID;
24         int FailNow;
25         HashList *MailQEntries;
26         MailQEntry *Current; /* copy of the currently parsed item in the MailQEntries list; if null add a new one. */
27         DeliveryAttempt LastAttempt;
28         long ActiveDeliveries;
29         StrBuf *EnvelopeFrom;
30         StrBuf *BounceTo;
31 } OneQueItem;
32 typedef void (*QItemHandler)(OneQueItem *Item, StrBuf *Line, const char **Pos);
33
34 int DecreaseQReference(OneQueItem *MyQItem);
35 void RemoveQItem(OneQueItem *MyQItem);
36 int CountActiveQueueEntries(OneQueItem *MyQItem);
37 StrBuf *SerializeQueueItem(OneQueItem *MyQItem);