Added message-id to the list of fields CtdlOutputMsg() can potentially return to...
authorArt Cancro <ajc@uncensored.citadel.org>
Wed, 12 Feb 2014 20:13:41 +0000 (15:13 -0500)
committerArt Cancro <ajc@uncensored.citadel.org>
Wed, 12 Feb 2014 20:13:41 +0000 (15:13 -0500)
citadel/modules/ctdlproto/serv_messages.c
citadel/modules/imap/imap_fetch.c
citadel/modules/pop3/serv_pop3.c
citadel/modules/smtp/serv_smtpqueue.c
citadel/modules/smtp/smtp_util.c
citadel/msgbase.c
citadel/msgbase.h

index 46c540f83937652096ee6546735b1c06cfdeb163..2d3208a221640a8c16f6ae0ce755e27de8c791df 100644 (file)
@@ -191,7 +191,7 @@ void cmd_msg0(char *cmdbuf)
        msgid = extract_long(cmdbuf, 0);
        headers_only = extract_int(cmdbuf, 1);
 
-       CtdlOutputMsg(msgid, MT_CITADEL, headers_only, 1, 0, NULL, 0, NULL, NULL);
+       CtdlOutputMsg(msgid, MT_CITADEL, headers_only, 1, 0, NULL, 0, NULL, NULL, NULL);
        return;
 }
 
@@ -207,7 +207,7 @@ void cmd_msg2(char *cmdbuf)
        msgid = extract_long(cmdbuf, 0);
        headers_only = extract_int(cmdbuf, 1);
 
-       CtdlOutputMsg(msgid, MT_RFC822, headers_only, 1, 1, NULL, 0, NULL, NULL);
+       CtdlOutputMsg(msgid, MT_RFC822, headers_only, 1, 1, NULL, 0, NULL, NULL, NULL);
 }
 
 
@@ -261,7 +261,7 @@ void cmd_msg4(char *cmdbuf)
 
        msgid = extract_long(cmdbuf, 0);
        extract_token(section, cmdbuf, 1, '|', sizeof section);
-       CtdlOutputMsg(msgid, MT_MIME, 0, 1, 0, (section[0] ? section : NULL) , 0, NULL, NULL);
+       CtdlOutputMsg(msgid, MT_MIME, 0, 1, 0, (section[0] ? section : NULL) , 0, NULL, NULL, NULL);
 }
 
 
@@ -294,7 +294,7 @@ void cmd_opna(char *cmdbuf)
        extract_token(desired_section, cmdbuf, 1, '|', sizeof desired_section);
        safestrncpy(CC->download_desired_section, desired_section,
                sizeof CC->download_desired_section);
-       CtdlOutputMsg(msgid, MT_DOWNLOAD, 0, 1, 1, NULL, 0, NULL, NULL);
+       CtdlOutputMsg(msgid, MT_DOWNLOAD, 0, 1, 1, NULL, 0, NULL, NULL, NULL);
 }                      
 
 
@@ -310,7 +310,7 @@ void cmd_dlat(char *cmdbuf)
        extract_token(desired_section, cmdbuf, 1, '|', sizeof desired_section);
        safestrncpy(CC->download_desired_section, desired_section,
                sizeof CC->download_desired_section);
-       CtdlOutputMsg(msgid, MT_SPEW_SECTION, 0, 1, 1, NULL, 0, NULL, NULL);
+       CtdlOutputMsg(msgid, MT_SPEW_SECTION, 0, 1, 1, NULL, 0, NULL, NULL, NULL);
 }
 
 /*
index 75a4cdbea5a395b5a23ff182befe3acfde6587ba..3f00d3f3f65c26380005589c3fc8d8d21bb1d37d 100644 (file)
@@ -190,7 +190,7 @@ void imap_fetch_rfc822(long msgnum, const char *whichfmt) {
                CCC->redirect_buffer = NewStrBufPlain(NULL, SIZ);
                CtdlOutputMsg(msgnum, MT_RFC822,
                        (need_body ? HEADERS_ALL : HEADERS_FAST),
-                       0, 1, NULL, SUPPRESS_ENV_TO, NULL, NULL
+                       0, 1, NULL, SUPPRESS_ENV_TO, NULL, NULL, NULL
                );
                if (!need_body) IAPuts("\r\n"); /* extra trailing newline */
                Imap->cached_rfc822 = CCC->redirect_buffer;
index 5468af94bacecb2f092579dd44c17a33fdcaf49f..fcc194cca6b0119fbf4b5abb6a911a4ea9e9d57c 100644 (file)
@@ -195,7 +195,7 @@ void pop3_add_message(long msgnum, void *userdata)
                              HEADERS_ALL,
                              0, 1, NULL,
                              SUPPRESS_ENV_TO,
-                             NULL, NULL);
+                             NULL, NULL, NULL);
 
                smi.meta_rfc822_length = StrLength(CCC->redirect_buffer);
                FreeStrBuf(&CCC->redirect_buffer); /* TODO: WHEW, all this for just knowing the length???? */
@@ -359,7 +359,7 @@ void pop3_retr(char *argbuf) {
        CtdlOutputMsg(POP3->msgs[which_one - 1].msgnum,
                      MT_RFC822, HEADERS_ALL, 0, 1, NULL,
                      (ESC_DOT|SUPPRESS_ENV_TO),
-                     NULL, NULL);
+                     NULL, NULL, NULL);
        cprintf(".\r\n");
 }
 
@@ -397,7 +397,7 @@ void pop3_top(char *argbuf)
                      HEADERS_ALL,
                      0, 1, NULL,
                      SUPPRESS_ENV_TO,
-                     NULL, NULL);
+                     NULL, NULL, NULL);
 
        msgtext = CCC->redirect_buffer;
        CCC->redirect_buffer = NULL;
index 9a618e092ee88731c465c2e2683a397293a2a0f7..df04bdcc5f713f66ebdb138c9d2bc73ab1067458 100644 (file)
@@ -492,7 +492,8 @@ StrBuf *smtp_load_msg(OneQueItem *MyQItem, int n, char **Author, char **Address)
                      0, 1, NULL,
                      (ESC_DOT|SUPPRESS_ENV_TO),
                      Author,
-                     Address);
+                     Address,
+                       NULL);
 
        SendMsg = CCC->redirect_buffer;
        CCC->redirect_buffer = NULL;
index e4a4c2da5eadb0e83c6d1e3597354f37d9a914ea..8609f91133bcd86e71d7c0f73ebeec569fe7fc8e 100644 (file)
@@ -272,7 +272,7 @@ void smtp_do_bounce(char *instr, StrBuf *OMsgTxt)
                                      MT_RFC822,
                                      HEADERS_ALL,
                                      0, 1, NULL, 0,
-                                     NULL, NULL);
+                                     NULL, NULL, NULL);
 
                        StrBufAppendBuf(BounceMB, CC->redirect_buffer, 0);
                        FreeStrBuf(&CC->redirect_buffer);
index 22b41b38fa4a23765563289885ab45858cafa316..4c1bd70ed2bdb2fedc8c1579e5c3a0f313909798 100644 (file)
@@ -1521,14 +1521,15 @@ int check_cached_msglist(long msgnum) {
  * 
  */
 int CtdlOutputMsg(long msg_num,                /* message number (local) to fetch */
-                 int mode,             /* how would you like that message? */
-                 int headers_only,     /* eschew the message body? */
-                 int do_proto,         /* do Citadel protocol responses? */
-                 int crlf,             /* Use CRLF newlines instead of LF? */
-                 char *section,        /* NULL or a message/rfc822 section */
-                 int flags,            /* various flags; see msgbase.h */
-                 char **Author,
-                 char **Address
+               int mode,               /* how would you like that message? */
+               int headers_only,       /* eschew the message body? */
+               int do_proto,           /* do Citadel protocol responses? */
+               int crlf,               /* Use CRLF newlines instead of LF? */
+               char *section,          /* NULL or a message/rfc822 section */
+               int flags,              /* various flags; see msgbase.h */
+               char **Author,
+               char **Address,
+               char **MessageID
 ) {
        struct CitContext *CCC = CC;
        struct CtdlMessage *TheMessage = NULL;
@@ -1616,6 +1617,11 @@ int CtdlOutputMsg(long msg_num,          /* message number (local) to fetch */
                        long len;
                        CM_GetAsField(TheMessage, erFc822Addr, Address, &len);
                }
+               if ((MessageID != NULL) && (*MessageID == NULL))
+               {       
+                       long len;
+                       CM_GetAsField(TheMessage, emessageId, MessageID, &len);
+               }
                CM_Free(TheMessage);
                TheMessage = NULL;
 
@@ -1655,6 +1661,11 @@ int CtdlOutputMsg(long msg_num,          /* message number (local) to fetch */
                long len;
                CM_GetAsField(TheMessage, erFc822Addr, Address, &len);
        }
+       if ((MessageID != NULL) && (*MessageID == NULL))
+       {       
+               long len;
+               CM_GetAsField(TheMessage, emessageId, MessageID, &len);
+       }
 
        CM_Free(TheMessage);
 
index aecdb18f6c9525dce5ea8578f464b39ff152006b..e4e2317b61b4a982d331b0c1616436b6178a0221 100644 (file)
@@ -165,14 +165,15 @@ StrBuf *CtdlReadMessageBodyBuf(char *terminator,  /* token signalling EOT */
        );
 
 int CtdlOutputMsg(long msg_num,                /* message number (local) to fetch */
-                 int mode,             /* how would you like that message? */
-                 int headers_only,     /* eschew the message body? */
-                 int do_proto,         /* do Citadel protocol responses? */
-                 int crlf,             /* 0=LF, 1=CRLF */
-                 char *section,                /* output a message/rfc822 section */
-                 int flags,            /* should the bessage be exported clean? */
-                 char **Author,        /* if you want to know the author of the message... */
-                 char **Address        /* if you want to know the sender address of the message... */
+               int mode,               /* how would you like that message? */
+               int headers_only,       /* eschew the message body? */
+               int do_proto,           /* do Citadel protocol responses? */
+               int crlf,               /* 0=LF, 1=CRLF */
+               char *section,          /* output a message/rfc822 section */
+               int flags,              /* should the bessage be exported clean? */
+               char **Author,          /* if you want to know the author of the message... */
+               char **Address,         /* if you want to know the sender address of the message... */
+               char **MessageID        /* if you want to know the Message-ID of the message... */
 );
 
 /* Flags which may be passed to CtdlOutputMsg() and CtdlOutputPreLoadedMsg() */