]> code.citadel.org Git - citadel.git/blobdiff - citadel/modules/smtp/serv_smtpeventclient.c
SMTP-Client: when relaying failed also notify aide that somethings broken.
[citadel.git] / citadel / modules / smtp / serv_smtpeventclient.c
index 56deb4f5034f1785952ea0e6cf6ca4b6830bfdb9..03697d30cf04c6c6f8cf1bd22e7a0a9eaa7d3a80 100644 (file)
@@ -153,9 +153,10 @@ eNextState FinalizeMessageSend_DB(AsyncIO *IO)
 
        Msg->IDestructQueItem = DecreaseQReference(Msg->MyQItem);
 
-       Msg->nRemain = CountActiveQueueEntries(Msg->MyQItem);
+       Msg->nRemain = CountActiveQueueEntries(Msg->MyQItem, 0);
 
        if (Msg->MyQEntry->Active && 
+           !Msg->MyQEntry->StillActive &&
            CheckQEntryIsBounce(Msg->MyQEntry))
        {
                /* are we casue for a bounce mail? */
@@ -176,7 +177,7 @@ eNextState FinalizeMessageSend_DB(AsyncIO *IO)
        Msg->MyQItem->QueMsgID = -1;
 
        if (Msg->IDestructQueItem)
-               smtpq_do_bounce(Msg->MyQItem, Msg->msgtext);
+               smtpq_do_bounce(Msg->MyQItem, Msg->msgtext, Msg->pCurrRelay);
 
        if (Msg->nRemain > 0)
        {
@@ -237,6 +238,13 @@ eNextState FailOneAttempt(AsyncIO *IO)
 
        if (Msg->pCurrRelay != NULL)
                Msg->pCurrRelay = Msg->pCurrRelay->Next;
+       if ((Msg->pCurrRelay != NULL) &&
+           !Msg->pCurrRelay->IsRelay &&
+           Msg->MyQItem->HaveRelay)
+       {
+               EVS_syslog(LOG_DEBUG, "%s Aborting; last relay failed.\n", __FUNCTION__);
+               return eAbort;
+       }
 
        if (Msg->pCurrRelay == NULL) {
                EVS_syslog(LOG_DEBUG, "%s Aborting\n", __FUNCTION__);