libev migration: start out with creating support for 'fallbackhost'
authorWilfried Goesgens <dothebart@citadel.org>
Thu, 3 Feb 2011 21:34:38 +0000 (22:34 +0100)
committerWilfried Goesgens <dothebart@citadel.org>
Thu, 3 Feb 2011 21:34:38 +0000 (22:34 +0100)
citadel/modules/smtp/serv_smtpqueue.c
citadel/modules/smtp/smtpqueue.h

index c071daf2b8f7cdf44ac91d46d525eb42f8c44950..bdf1a323a29390f69d9c24dd13faf7eb43967b06 100644 (file)
@@ -783,6 +783,26 @@ void smtp_do_procmsg(long msgnum, void *userdata) {
                        FreeStrBuf(&All);
                        FreeStrBuf(&One);
                }
+
+               Url = &MyQItem->FallBackHost;
+               nRelays = get_hosts(mxbuf, "fallbackhost");
+               if (nRelays > 0) {
+                       StrBuf *All;
+                       StrBuf *One;
+                       const char *Pos = NULL;
+                       All = NewStrBufPlain(mxbuf, -1);
+                       One = NewStrBufPlain(NULL, StrLength(All) + 1);
+                       
+                       while ((Pos != StrBufNOTNULL) && ((Pos == NULL) || !IsEmptyStr(Pos))) {
+                               StrBufExtract_NextToken(One, All, &Pos, '|');
+                               if (!ParseURL(Url, One, 25))
+                                       CtdlLogPrintf(CTDL_DEBUG, "Failed to parse: %s\n", ChrPtr(One));
+                               else 
+                                       Url = &(*Url)->Next;
+                       }
+                       FreeStrBuf(&All);
+                       FreeStrBuf(&One);
+               }
        }
 
        It = GetNewHashPos(MyQItem->MailQEntries, 0);
index 0da68956184dcf1c0b5e0dd29006da1df5e3874e..b2b7a3bb9359b86e903d2c17ffcad87f96a58b76 100644 (file)
@@ -55,6 +55,7 @@ typedef struct queueitem {
        StrBuf *EnvelopeFrom;
        StrBuf *BounceTo;
        ParsedURL *URL;
+       ParsedURL *FallBackHost;
 } OneQueItem;
 typedef void (*QItemHandler)(OneQueItem *Item, StrBuf *Line, const char **Pos);