-#ifdef EXPERIMENTAL_SMTP_EVENT_CLIENT
-HashList *QItemHandlers = NULL;
-
-citthread_mutex_t ActiveQItemsLock;
-HashList *ActiveQItems = NULL;
-
-int run_queue_now = 0; /* Set to 1 to ignore SMTP send retry times */
-int MsgCount = 0;
-/*****************************************************************************/
-/* SMTP CLIENT (Queue Management) STUFF */
-/*****************************************************************************/
-
-#define MaxAttempts 15
-typedef struct _delivery_attempt {
- time_t when;
- time_t retry;
-}DeliveryAttempt;
-
-typedef struct _mailq_entry {
- DeliveryAttempt Attempts[MaxAttempts];
- int nAttempts;
- StrBuf *Recipient;
- StrBuf *StatusMessage;
- int Status;
- int n;
- int Active;
-}MailQEntry;
-void FreeMailQEntry(void *qv)
-{
- MailQEntry *Q = qv;
- FreeStrBuf(&Q->Recipient);
- FreeStrBuf(&Q->StatusMessage);
- free(Q);
-}
-
-typedef struct queueitem {
- long MessageID;
- long QueMsgID;
- int FailNow;
- HashList *MailQEntries;
- MailQEntry *Current; /* copy of the currently parsed item in the MailQEntries list; if null add a new one. */
- DeliveryAttempt LastAttempt;
- long ActiveDeliveries;
- StrBuf *EnvelopeFrom;
- StrBuf *BounceTo;
-} OneQueItem;
-typedef void (*QItemHandler)(OneQueItem *Item, StrBuf *Line, const char **Pos);
-
-/*****************************************************************************/
-/* SMTP CLIENT (OUTBOUND PROCESSING) STUFF */
-/*****************************************************************************/
-
-typedef enum _eSMTP_C_States {
- eConnect,
- eEHLO,
- eHELO,
- eSMTPAuth,
- eFROM,
- eRCPT,
- eDATA,
- eDATABody,
- eDATATerminateBody,
- eQUIT,
- eMaxSMTPC
-} eSMTP_C_States;
-
-const long SMTP_C_ReadTimeouts[eMaxSMTPC] = {
- 90, /* Greeting... */
- 30, /* EHLO */
- 30, /* HELO */
- 30, /* Auth */
- 30, /* From */
- 30, /* RCPT */
- 30, /* DATA */
- 90, /* DATABody */
- 900, /* end of body... */
- 30 /* QUIT */
-};
-/*
-const long SMTP_C_SendTimeouts[eMaxSMTPC] = {
-
-}; */
-const char *ReadErrors[eMaxSMTPC] = {
- "Connection broken during SMTP conversation",
- "Connection broken during SMTP EHLO",
- "Connection broken during SMTP HELO",
- "Connection broken during SMTP AUTH",
- "Connection broken during SMTP MAIL FROM",
- "Connection broken during SMTP RCPT",
- "Connection broken during SMTP DATA",
- "Connection broken during SMTP message transmit",
- ""/* quit reply, don't care. */
-};
-
-
-typedef struct _stmp_out_msg {
- MailQEntry *MyQEntry;
- OneQueItem *MyQItem;
- long n;
- AsyncIO IO;
-
- eSMTP_C_States State;
-
-/// int SMTPstatus; ->MyQEntry->Status
-
- int i_mx;
- int n_mx;
- int num_mxhosts;
- char mx_user[1024];
- char mx_pass[1024];
- char mx_host[1024];
- char mx_port[1024];
- char mxhosts[SIZ];
-
- StrBuf *msgtext;
- char *envelope_from;
- char user[1024];
- char node[1024];
- char name[1024];
-/// char addr[SIZ]; -> MyQEntry->Recipient
-/// char dsn[1024]; -> MyQEntry->StatusMessage
-/// char envelope_from_buf[1024]; MyQItem->EnvelopeFrom
- char mailfrom[1024];
-} SmtpOutMsg;