From 80172bd70dde62001e0779f39efd4ad9835788d9 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Wed, 12 Feb 2014 15:13:41 -0500 Subject: [PATCH] Added message-id to the list of fields CtdlOutputMsg() can potentially return to the caller --- citadel/modules/ctdlproto/serv_messages.c | 10 ++++----- citadel/modules/imap/imap_fetch.c | 2 +- citadel/modules/pop3/serv_pop3.c | 6 ++--- citadel/modules/smtp/serv_smtpqueue.c | 3 ++- citadel/modules/smtp/smtp_util.c | 2 +- citadel/msgbase.c | 27 ++++++++++++++++------- citadel/msgbase.h | 17 +++++++------- 7 files changed, 40 insertions(+), 27 deletions(-) diff --git a/citadel/modules/ctdlproto/serv_messages.c b/citadel/modules/ctdlproto/serv_messages.c index 46c540f83..2d3208a22 100644 --- a/citadel/modules/ctdlproto/serv_messages.c +++ b/citadel/modules/ctdlproto/serv_messages.c @@ -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); } /* diff --git a/citadel/modules/imap/imap_fetch.c b/citadel/modules/imap/imap_fetch.c index 75a4cdbea..3f00d3f3f 100644 --- a/citadel/modules/imap/imap_fetch.c +++ b/citadel/modules/imap/imap_fetch.c @@ -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; diff --git a/citadel/modules/pop3/serv_pop3.c b/citadel/modules/pop3/serv_pop3.c index 5468af94b..fcc194cca 100644 --- a/citadel/modules/pop3/serv_pop3.c +++ b/citadel/modules/pop3/serv_pop3.c @@ -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; diff --git a/citadel/modules/smtp/serv_smtpqueue.c b/citadel/modules/smtp/serv_smtpqueue.c index 9a618e092..df04bdcc5 100644 --- a/citadel/modules/smtp/serv_smtpqueue.c +++ b/citadel/modules/smtp/serv_smtpqueue.c @@ -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; diff --git a/citadel/modules/smtp/smtp_util.c b/citadel/modules/smtp/smtp_util.c index e4a4c2da5..8609f9113 100644 --- a/citadel/modules/smtp/smtp_util.c +++ b/citadel/modules/smtp/smtp_util.c @@ -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); diff --git a/citadel/msgbase.c b/citadel/msgbase.c index 22b41b38f..4c1bd70ed 100644 --- a/citadel/msgbase.c +++ b/citadel/msgbase.c @@ -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); diff --git a/citadel/msgbase.h b/citadel/msgbase.h index aecdb18f6..e4e2317b6 100644 --- a/citadel/msgbase.h +++ b/citadel/msgbase.h @@ -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() */ -- 2.30.2