]> code.citadel.org Git - citadel.git/blobdiff - citadel/modules/smtp/serv_smtpeventclient.c
Merge branch 'configdb' of ssh://git.citadel.org/appl/gitroot/citadel
[citadel.git] / citadel / modules / smtp / serv_smtpeventclient.c
index 3be726e8503e40848a96e85f117947f75685232f..337aa494bebcead232688fdf6b0c3691b9ec9d08 100644 (file)
@@ -127,6 +127,7 @@ void DeleteSmtpOutMsg(void *v)
                Msg->HostLookup.DNSReplyFree(Msg->HostLookup.VParsedDNSReply);
        FreeURL(&Msg->Relay);
        FreeStrBuf(&Msg->msgtext);
+       FreeStrBuf(&Msg->MultiLineBuf);
        FreeAsyncIOContents(&Msg->IO);
        memset (Msg, 0, sizeof(SmtpOutMsg)); /* just to be shure... */
        free(Msg);
@@ -254,7 +255,7 @@ eNextState Terminate(AsyncIO *IO)
 eNextState FinalizeMessageSend(SmtpOutMsg *Msg)
 {
        /* hand over to DB Queue */
-       return EventQueueDBOperation(&Msg->IO, FinalizeMessageSend_DB);
+       return EventQueueDBOperation(&Msg->IO, FinalizeMessageSend_DB, 0);
 }
 
 eNextState FailOneAttempt(AsyncIO *IO)
@@ -287,12 +288,12 @@ eNextState FailOneAttempt(AsyncIO *IO)
            Msg->MyQItem->HaveRelay)
        {
                EVS_syslog(LOG_DEBUG, "%s Aborting; last relay failed.\n", __FUNCTION__);
-               return eAbort;
+               return FinalizeMessageSend(Msg);
        }
 
        if (Msg->pCurrRelay == NULL) {
                EVS_syslog(LOG_DEBUG, "%s Aborting\n", __FUNCTION__);
-               return eAbort;
+               return FinalizeMessageSend(Msg);
        }
        if (Msg->pCurrRelay->IsIP) {
                EVS_syslog(LOG_DEBUG, "%s connecting IP\n", __FUNCTION__);
@@ -864,7 +865,16 @@ eReadState SMTP_C_ReadServerStatus(AsyncIO *IO)
                        if (StrLength(IO->IOBuf) < 4)
                                continue;
                        if (ChrPtr(IO->IOBuf)[3] == '-')
+                       {
+                               SmtpOutMsg *Msg;
+                               Msg = (SmtpOutMsg *)IO->Data;
+                               if (Msg->MultiLineBuf == NULL)
+                                       Msg->MultiLineBuf = NewStrBuf ();
+                               else
+                                       StrBufAppendBufPlain(Msg->MultiLineBuf, HKEY("\n"), 0);
+                               StrBufAppendBuf(Msg->MultiLineBuf, IO->IOBuf, 0);
                                Finished = eBufferNotEmpty;
+                       }
                        else
                                return Finished;
                        break;