void FreeMailQEntry(void *qv)
{
MailQEntry *Q = qv;
+/*
+ syslog(LOG_DEBUG, "---------------%s--------------", __FUNCTION__);
+ cit_backtrace();
+*/
FreeStrBuf(&Q->Recipient);
FreeStrBuf(&Q->StatusMessage);
+
+ memset(Q, 0, sizeof(MailQEntry));
free(Q);
}
void FreeQueItem(OneQueItem **Item)
{
+/*
+ syslog(LOG_DEBUG, "---------------%s--------------", __FUNCTION__);
+ cit_backtrace();
+*/
DeleteHash(&(*Item)->MailQEntries);
FreeStrBuf(&(*Item)->EnvelopeFrom);
FreeStrBuf(&(*Item)->BounceTo);
FreeStrBuf(&(*Item)->SenderRoom);
FreeURL(&(*Item)->URL);
+ memset(*Item, 0, sizeof(OneQueItem));
free(*Item);
Item = NULL;
}
* - 3/4 (transient errors
* were experienced and it's time to try again)
*/
+int CheckQEntryActive(MailQEntry *ThisItem)
+{
+ if ((ThisItem->Status == 0) ||
+ (ThisItem->Status == 3) ||
+ (ThisItem->Status == 4))
+ {
+ return 1;
+ }
+ else
+ return 0;
+}
+int CheckQEntryIsBounce(MailQEntry *ThisItem)
+{
+ if ((ThisItem->Status == 3) ||
+ (ThisItem->Status == 4) ||
+ (ThisItem->Status == 5))
+ {
+ return 1;
+ }
+ else
+ return 0;
+}
+
int CountActiveQueueEntries(OneQueItem *MyQItem)
{
HashPos *It;
while (GetNextHashPos(MyQItem->MailQEntries, It, &len, &Key, &vQE))
{
MailQEntry *ThisItem = vQE;
- if ((ThisItem->Status == 0) ||
- (ThisItem->Status == 3) ||
- (ThisItem->Status == 4))
+
+ if (CheckQEntryActive(ThisItem))
{
ActiveDeliveries++;
ThisItem->Active = 1;
{
MailQEntry *ThisItem = vQE;
- if (!ThisItem->Active)
- {
- /* skip already sent ones from the spoolfile. */
- continue;
- }
StrBufAppendBufPlain(QMessage, HKEY("\nremote|"), 0);
StrBufAppendBuf(QMessage, ThisItem->Recipient, 0);
StrBufAppendBufPlain(QMessage, HKEY("|"), 0);
syslog(LOG_DEBUG, "smtp_do_bounce() called\n");
+ if (!MyQItem->SendBounceMail)
+ return;
+
if ( (ev_time() - MyQItem->Submitted) > SMTP_GIVE_UP ) {
give_up = 1;/// TODO: replace time by libevq timer get
}
Put(QItemHandlers, HKEY("submitted"), QItem_Handle_Submitted, reference_free_handler);
smtp_init_spoolout();
- CtdlRegisterCleanupHook(smtp_evq_cleanup);
+ CtdlRegisterEVCleanupHook(smtp_evq_cleanup);
CtdlRegisterProtoHook(cmd_smtp, "SMTP", "SMTP utility commands");
CtdlRegisterSessionHook(smtp_do_queue, EVT_TIMER);