From e87452481eae22f861f601fdb082a4fa75567dc4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Wilfried=20G=C3=B6esgens?= Date: Sat, 24 May 2008 14:37:02 +0000 Subject: [PATCH] * make QP encoding of senders optional, so we can flag it if we need it. --- citadel/journaling.c | 2 +- citadel/modules/calendar/serv_calendar.c | 8 +-- citadel/modules/chat/serv_chat.c | 2 +- citadel/modules/dspam/serv_dspam.c | 2 +- citadel/modules/fulltext/serv_fulltext.c | 2 +- citadel/modules/imap/imap_fetch.c | 12 ++--- citadel/modules/imap/imap_misc.c | 2 +- citadel/modules/imap/imap_search.c | 2 +- citadel/modules/network/serv_network.c | 12 ++--- citadel/modules/pop3/serv_pop3.c | 6 +-- citadel/modules/pop3client/serv_pop3client.c | 2 +- citadel/modules/rssclient/serv_rssclient.c | 2 +- citadel/modules/sieve/serv_sieve.c | 4 +- citadel/modules/smtp/serv_smtp.c | 12 ++--- citadel/modules/spam/serv_spam.c | 2 +- citadel/modules/vcard/serv_vcard.c | 4 +- citadel/msgbase.c | 52 +++++++++++--------- citadel/msgbase.h | 25 ++++++---- 18 files changed, 82 insertions(+), 71 deletions(-) diff --git a/citadel/journaling.c b/citadel/journaling.c index 9fc8246ea..6f5e69644 100644 --- a/citadel/journaling.c +++ b/citadel/journaling.c @@ -244,7 +244,7 @@ void JournalRunQueueMsg(struct jnlq *jmsg) { free(jmsg->msgn); /* Submit journal message */ - CtdlSubmitMsg(journal_msg, journal_recps, ""); + CtdlSubmitMsg(journal_msg, journal_recps, "", 0); CtdlFreeMessage(journal_msg); } diff --git a/citadel/modules/calendar/serv_calendar.c b/citadel/modules/calendar/serv_calendar.c index cc134e0d1..e9a96e5f0 100644 --- a/citadel/modules/calendar/serv_calendar.c +++ b/citadel/modules/calendar/serv_calendar.c @@ -167,7 +167,7 @@ void ical_write_to_cal(struct ctdluser *u, icalcomponent *cal) { strcat(msg->cm_fields['M'], ser); /* Now write the data */ - CtdlSubmitMsg(msg, NULL, ""); + CtdlSubmitMsg(msg, NULL, "", QP_EADDR); CtdlFreeMessage(msg); } @@ -349,7 +349,7 @@ void ical_send_a_reply(icalcomponent *request, char *action) { if (msg != NULL) { valid = validate_recipients(organizer_string, NULL, 0); - CtdlSubmitMsg(msg, valid, ""); + CtdlSubmitMsg(msg, valid, "", QP_EADDR); CtdlFreeMessage(msg); free_recipients(valid); } @@ -725,7 +725,7 @@ int ical_update_my_calendar_with_reply(icalcomponent *cal) { if (msg != NULL) { CIT_ICAL->avoid_sending_invitations = 1; - CtdlSubmitMsg(msg, NULL, roomname); + CtdlSubmitMsg(msg, NULL, roomname, QP_EADDR); CtdlFreeMessage(msg); CIT_ICAL->avoid_sending_invitations = 0; } @@ -1799,7 +1799,7 @@ void ical_send_out_invitations(icalcomponent *cal) { if (msg != NULL) { valid = validate_recipients(attendees_string, NULL, 0); - CtdlSubmitMsg(msg, valid, ""); + CtdlSubmitMsg(msg, valid, "", QP_EADDR); CtdlFreeMessage(msg); free_recipients(valid); } diff --git a/citadel/modules/chat/serv_chat.c b/citadel/modules/chat/serv_chat.c index afc03dbb4..2cf3bb233 100644 --- a/citadel/modules/chat/serv_chat.c +++ b/citadel/modules/chat/serv_chat.c @@ -644,7 +644,7 @@ int send_instant_message(char *lun, char *lem, char *x_user, char *x_msg) * creating the room if necessary. */ create_room(PAGELOGROOM, 4, "", 0, 1, 0, VIEW_BBS); - msgnum = CtdlSubmitMsg(logmsg, NULL, PAGELOGROOM); + msgnum = CtdlSubmitMsg(logmsg, NULL, PAGELOGROOM, 0); /* Now save a copy in the global log room, if configured */ if (!IsEmptyStr(config.c_logpages)) { diff --git a/citadel/modules/dspam/serv_dspam.c b/citadel/modules/dspam/serv_dspam.c index e0f478f6c..1c0c0d7c4 100644 --- a/citadel/modules/dspam/serv_dspam.c +++ b/citadel/modules/dspam/serv_dspam.c @@ -136,7 +136,7 @@ void dspam_do_msg(long msgnum, void *userdata) CC->redirect_buffer = malloc(SIZ); CC->redirect_len = 0; CC->redirect_alloc = SIZ; - CtdlOutputPreLoadedMsg(msg, MT_RFC822, HEADERS_ALL, 0, 1); + CtdlOutputPreLoadedMsg(msg, MT_RFC822, HEADERS_ALL, 0, 1, 0); msgtext = CC->redirect_buffer; // don't need? msglen = CC->redirect_len; CC->redirect_buffer = NULL; diff --git a/citadel/modules/fulltext/serv_fulltext.c b/citadel/modules/fulltext/serv_fulltext.c index 131c52256..5147bad19 100644 --- a/citadel/modules/fulltext/serv_fulltext.c +++ b/citadel/modules/fulltext/serv_fulltext.c @@ -120,7 +120,7 @@ void ft_index_message(long msgnum, int op) { CC->redirect_buffer = malloc(SIZ); CC->redirect_len = 0; CC->redirect_alloc = SIZ; - CtdlOutputMsg(msgnum, MT_CITADEL, HEADERS_ALL, 0, 1, NULL); + CtdlOutputMsg(msgnum, MT_CITADEL, HEADERS_ALL, 0, 1, NULL, 0); msgtext = CC->redirect_buffer; CC->redirect_buffer = NULL; CC->redirect_len = 0; diff --git a/citadel/modules/imap/imap_fetch.c b/citadel/modules/imap/imap_fetch.c index bff79381e..436a4b243 100644 --- a/citadel/modules/imap/imap_fetch.c +++ b/citadel/modules/imap/imap_fetch.c @@ -175,7 +175,7 @@ void imap_fetch_rfc822(long msgnum, char *whichfmt) { CC->redirect_alloc = SIZ; CtdlOutputMsg(msgnum, MT_RFC822, (need_body ? HEADERS_ALL : HEADERS_ONLY), - 0, 1, NULL); + 0, 1, NULL, 0); if (!need_body) cprintf("\r\n"); /* extra trailing newline */ IMAP->cached_rfc822_data = CC->redirect_buffer; IMAP->cached_rfc822_len = CC->redirect_len; @@ -651,11 +651,11 @@ void imap_fetch_body(long msgnum, char *item, int is_peek) { } else if ( (!strcmp(section, "1")) && (msg->cm_format_type != 4) ) { - CtdlOutputPreLoadedMsg(msg, MT_RFC822, HEADERS_NONE, 0, 1); + CtdlOutputPreLoadedMsg(msg, MT_RFC822, HEADERS_NONE, 0, 1, 0); } else if (!strcmp(section, "")) { - CtdlOutputPreLoadedMsg(msg, MT_RFC822, HEADERS_ALL, 0, 1); + CtdlOutputPreLoadedMsg(msg, MT_RFC822, HEADERS_ALL, 0, 1, 0); } /* @@ -663,7 +663,7 @@ void imap_fetch_body(long msgnum, char *item, int is_peek) { * fields, strip it down. */ else if (!strncasecmp(section, "HEADER", 6)) { - CtdlOutputPreLoadedMsg(msg, MT_RFC822, HEADERS_ONLY, 0, 1); + CtdlOutputPreLoadedMsg(msg, MT_RFC822, HEADERS_ONLY, 0, 1, 0); imap_strip_headers(section); } @@ -671,7 +671,7 @@ void imap_fetch_body(long msgnum, char *item, int is_peek) { * Strip it down if the client asked for everything _except_ headers. */ else if (!strncasecmp(section, "TEXT", 4)) { - CtdlOutputPreLoadedMsg(msg, MT_RFC822, HEADERS_NONE, 0, 1); + CtdlOutputPreLoadedMsg(msg, MT_RFC822, HEADERS_NONE, 0, 1, 0); } /* @@ -916,7 +916,7 @@ void imap_fetch_bodystructure (long msgnum, char *item, CC->redirect_buffer = malloc(SIZ); CC->redirect_len = 0; CC->redirect_alloc = SIZ; - CtdlOutputPreLoadedMsg(msg, MT_RFC822, 0, 0, 1); + CtdlOutputPreLoadedMsg(msg, MT_RFC822, 0, 0, 1, 0); rfc822 = CC->redirect_buffer; rfc822_len = CC->redirect_len; CC->redirect_buffer = NULL; diff --git a/citadel/modules/imap/imap_misc.c b/citadel/modules/imap/imap_misc.c index 9b15e4208..be350a572 100644 --- a/citadel/modules/imap/imap_misc.c +++ b/citadel/modules/imap/imap_misc.c @@ -477,7 +477,7 @@ void imap_append(int num_parms, char *parms[]) { else { /* Yes ... go ahead and post! */ if (msg != NULL) { - new_msgnum = CtdlSubmitMsg(msg, NULL, ""); + new_msgnum = CtdlSubmitMsg(msg, NULL, "", 0); } if (new_msgnum >= 0L) { cprintf("%s OK [APPENDUID %ld %ld] APPEND completed\r\n", diff --git a/citadel/modules/imap/imap_search.c b/citadel/modules/imap/imap_search.c index 7efc71ed6..661a9001d 100644 --- a/citadel/modules/imap/imap_search.c +++ b/citadel/modules/imap/imap_search.c @@ -241,7 +241,7 @@ int imap_do_search_msg(int seq, struct CtdlMessage *supplied_msg, CC->redirect_buffer = malloc(SIZ); CC->redirect_len = 0; CC->redirect_alloc = SIZ; - CtdlOutputPreLoadedMsg(msg, MT_RFC822, HEADERS_ONLY, 0, 1); + CtdlOutputPreLoadedMsg(msg, MT_RFC822, HEADERS_ONLY, 0, 1, 0); fieldptr = rfc822_fetch_field(CC->redirect_buffer, itemlist[pos+1]); if (fieldptr != NULL) { diff --git a/citadel/modules/network/serv_network.c b/citadel/modules/network/serv_network.c index 9258f3c9f..969cefed2 100644 --- a/citadel/modules/network/serv_network.c +++ b/citadel/modules/network/serv_network.c @@ -521,7 +521,7 @@ void network_deliver_digest(SpoolControl *sc) { /* Now submit the message */ valid = validate_recipients(recps, NULL, 0); free(recps); - CtdlSubmitMsg(msg, valid, NULL); + CtdlSubmitMsg(msg, valid, NULL, 0); CtdlFreeMessage(msg); free_recipients(valid); } @@ -568,7 +568,7 @@ void network_deliver_list(struct CtdlMessage *msg, SpoolControl *sc) { /* Now submit the message */ valid = validate_recipients(recps, NULL, 0); free(recps); - CtdlSubmitMsg(msg, valid, NULL); + CtdlSubmitMsg(msg, valid, NULL, 0); free_recipients(valid); /* Do not call CtdlFreeMessage(msg) here; the caller will free it. */ } @@ -670,7 +670,7 @@ void network_spool_msg(long msgnum, void *userdata) { CC->redirect_alloc = SIZ; safestrncpy(CC->preferred_formats, "text/plain", sizeof CC->preferred_formats); - CtdlOutputPreLoadedMsg(msg, MT_CITADEL, HEADERS_NONE, 0, 0); + CtdlOutputPreLoadedMsg(msg, MT_CITADEL, HEADERS_NONE, 0, 0, 0); striplt(CC->redirect_buffer); fprintf(sc->digestfp, "\n%s\n", CC->redirect_buffer); @@ -736,7 +736,7 @@ void network_spool_msg(long msgnum, void *userdata) { msg->cm_fields['R'] = strdup(nptr->name); valid = validate_recipients(nptr->name, NULL, 0); - CtdlSubmitMsg(msg, valid, ""); + CtdlSubmitMsg(msg, valid, "", 0); free_recipients(valid); } @@ -1407,7 +1407,7 @@ void network_bounce(struct CtdlMessage *msg, char *reason) { if ( (valid == NULL) && IsEmptyStr(force_room) ) { strcpy(force_room, config.c_aideroom); } - CtdlSubmitMsg(msg, valid, force_room); + CtdlSubmitMsg(msg, valid, force_room, 0); /* Clean up */ if (valid != NULL) free_recipients(valid); @@ -1583,7 +1583,7 @@ void network_process_buffer(char *buffer, long size) { /* save the message into a room */ if (PerformNetprocHooks(msg, target_room) == 0) { msg->cm_flags = CM_SKIP_HOOKS; - CtdlSubmitMsg(msg, recp, target_room); + CtdlSubmitMsg(msg, recp, target_room, 0); } CtdlFreeMessage(msg); free_recipients(recp); diff --git a/citadel/modules/pop3/serv_pop3.c b/citadel/modules/pop3/serv_pop3.c index e839f5ec9..43a2545d8 100644 --- a/citadel/modules/pop3/serv_pop3.c +++ b/citadel/modules/pop3/serv_pop3.c @@ -159,7 +159,7 @@ void pop3_add_message(long msgnum, void *userdata) { CC->redirect_buffer = malloc(SIZ); CC->redirect_len = 0; CC->redirect_alloc = SIZ; - CtdlOutputMsg(msgnum, MT_RFC822, HEADERS_ALL, 0, 1, NULL); + CtdlOutputMsg(msgnum, MT_RFC822, HEADERS_ALL, 0, 1, NULL, 0); smi.meta_rfc822_length = CC->redirect_len; free(CC->redirect_buffer); CC->redirect_buffer = NULL; @@ -381,7 +381,7 @@ void pop3_retr(char *argbuf) { CC->redirect_len = 0; CC->redirect_alloc = SIZ; CtdlOutputMsg(POP3->msgs[which_one - 1].msgnum, - MT_RFC822, HEADERS_ALL, 0, 1, NULL); + MT_RFC822, HEADERS_ALL, 0, 1, NULL, 0); msgtext = CC->redirect_buffer; CC->redirect_buffer = NULL; CC->redirect_len = 0; @@ -444,7 +444,7 @@ void pop3_top(char *argbuf) { CC->redirect_len = 0; CC->redirect_alloc = SIZ; CtdlOutputMsg(POP3->msgs[which_one - 1].msgnum, - MT_RFC822, HEADERS_ALL, 0, 1, NULL); + MT_RFC822, HEADERS_ALL, 0, 1, NULL, 0); msgtext = CC->redirect_buffer; CC->redirect_buffer = NULL; CC->redirect_len = 0; diff --git a/citadel/modules/pop3client/serv_pop3client.c b/citadel/modules/pop3client/serv_pop3client.c index 8015bd758..e27971000 100644 --- a/citadel/modules/pop3client/serv_pop3client.c +++ b/citadel/modules/pop3client/serv_pop3client.c @@ -200,7 +200,7 @@ void pop3_do_fetching(char *roomname, char *pop3host, char *pop3user, char *pop3 body = NULL; /* yes, this should be dereferenced, NOT freed */ /* Do Something With It (tm) */ - msgnum = CtdlSubmitMsg(msg, NULL, roomname); + msgnum = CtdlSubmitMsg(msg, NULL, roomname, 0); if (msgnum > 0L) { /* Message has been committed to the store */ diff --git a/citadel/modules/rssclient/serv_rssclient.c b/citadel/modules/rssclient/serv_rssclient.c index 4db28dbb5..c356e9d54 100644 --- a/citadel/modules/rssclient/serv_rssclient.c +++ b/citadel/modules/rssclient/serv_rssclient.c @@ -161,7 +161,7 @@ void rss_save_item(struct rss_item *ri) { ri->link, ri->link ); - CtdlSubmitMsg(msg, recp, NULL); + CtdlSubmitMsg(msg, recp, NULL, 0); CtdlFreeMessage(msg); /* write the uidl to the use table so we don't store this item again */ diff --git a/citadel/modules/sieve/serv_sieve.c b/citadel/modules/sieve/serv_sieve.c index 0006604f3..e8156501b 100644 --- a/citadel/modules/sieve/serv_sieve.c +++ b/citadel/modules/sieve/serv_sieve.c @@ -116,7 +116,7 @@ int ctdl_redirect(sieve2_context_t *s, void *my) return SIEVE2_ERROR_BADARGS; } - CtdlSubmitMsg(msg, valid, NULL); + CtdlSubmitMsg(msg, valid, NULL, 0); cs->cancel_implicit_keep = 1; free_recipients(valid); CtdlFreeMessage(msg); @@ -527,7 +527,7 @@ void sieve_do_msg(long msgnum, void *userdata) { CC->redirect_buffer = malloc(SIZ); CC->redirect_len = 0; CC->redirect_alloc = SIZ; - CtdlOutputPreLoadedMsg(msg, MT_RFC822, HEADERS_ONLY, 0, 1); + CtdlOutputPreLoadedMsg(msg, MT_RFC822, HEADERS_ONLY, 0, 1, 0); my.rfc822headers = CC->redirect_buffer; headers_len = CC->redirect_len; CC->redirect_buffer = NULL; diff --git a/citadel/modules/smtp/serv_smtp.c b/citadel/modules/smtp/serv_smtp.c index 43d2de624..fada0bf98 100644 --- a/citadel/modules/smtp/serv_smtp.c +++ b/citadel/modules/smtp/serv_smtp.c @@ -740,7 +740,7 @@ void smtp_data(void) { } else { /* Ok, we'll accept this message. */ - msgnum = CtdlSubmitMsg(msg, valid, ""); + msgnum = CtdlSubmitMsg(msg, valid, "", 0); if (msgnum > 0L) { sprintf(result, "250 Message accepted.\r\n"); } @@ -942,7 +942,7 @@ void smtp_try(const char *key, const char *addr, int *status, CC->redirect_buffer = malloc(SIZ); CC->redirect_len = 0; CC->redirect_alloc = SIZ; - CtdlOutputMsg(msgnum, MT_RFC822, HEADERS_ALL, 0, 1, NULL); + CtdlOutputMsg(msgnum, MT_RFC822, HEADERS_ALL, 0, 1, NULL, 0); msgtext = CC->redirect_buffer; msg_size = CC->redirect_len; CC->redirect_buffer = NULL; @@ -1437,7 +1437,7 @@ void smtp_do_bounce(char *instr) { CC->redirect_buffer = malloc(SIZ); CC->redirect_len = 0; CC->redirect_alloc = SIZ; - CtdlOutputMsg(omsgid, MT_RFC822, HEADERS_ALL, 0, 1, NULL); + CtdlOutputMsg(omsgid, MT_RFC822, HEADERS_ALL, 0, 1, NULL, 0); omsgtext = CC->redirect_buffer; omsgsize = CC->redirect_len; CC->redirect_buffer = NULL; @@ -1469,14 +1469,14 @@ void smtp_do_bounce(char *instr) { valid = validate_recipients(bounceto, smtp_get_Recipients (), 0); if (valid != NULL) { if (valid->num_error == 0) { - CtdlSubmitMsg(bmsg, valid, ""); + CtdlSubmitMsg(bmsg, valid, "", QP_EADDR); successful_bounce = 1; } } /* If not, post it in the Aide> room */ if (successful_bounce == 0) { - CtdlSubmitMsg(bmsg, NULL, config.c_aideroom); + CtdlSubmitMsg(bmsg, NULL, config.c_aideroom, QP_EADDR); } /* Free up the memory we used */ @@ -1705,7 +1705,7 @@ void smtp_do_procmsg(long msgnum, void *userdata) { "attempted|%ld\n" "retry|%ld\n", SPOOLMIME, instr, (long)time(NULL), (long)retry ); - CtdlSubmitMsg(msg, NULL, SMTP_SPOOLOUT_ROOM); + CtdlSubmitMsg(msg, NULL, SMTP_SPOOLOUT_ROOM, QP_EADDR); CtdlFreeMessage(msg); } diff --git a/citadel/modules/spam/serv_spam.c b/citadel/modules/spam/serv_spam.c index e8549ee4a..249f52e3e 100644 --- a/citadel/modules/spam/serv_spam.c +++ b/citadel/modules/spam/serv_spam.c @@ -101,7 +101,7 @@ int spam_assassin(struct CtdlMessage *msg) { CC->redirect_buffer = malloc(SIZ); CC->redirect_len = 0; CC->redirect_alloc = SIZ; - CtdlOutputPreLoadedMsg(msg, MT_RFC822, HEADERS_ALL, 0, 1); + CtdlOutputPreLoadedMsg(msg, MT_RFC822, HEADERS_ALL, 0, 1, 0); msgtext = CC->redirect_buffer; msglen = CC->redirect_len; CC->redirect_buffer = NULL; diff --git a/citadel/modules/vcard/serv_vcard.c b/citadel/modules/vcard/serv_vcard.c index 7180cd668..2175cf0b9 100644 --- a/citadel/modules/vcard/serv_vcard.c +++ b/citadel/modules/vcard/serv_vcard.c @@ -1041,7 +1041,7 @@ void vcard_purge(struct ctdluser *usbuf) { msg->cm_fields['S'] = strdup("CANCEL"); - CtdlSubmitMsg(msg, NULL, ADDRESS_BOOK_ROOM); + CtdlSubmitMsg(msg, NULL, ADDRESS_BOOK_ROOM, QP_EADDR); CtdlFreeMessage(msg); } @@ -1482,7 +1482,7 @@ void store_this_ha(struct addresses_to_be_filed *aptr) { vcard_free(v); CtdlLogPrintf(CTDL_DEBUG, "Adding contact: %s\n", recipient); - vmsgnum = CtdlSubmitMsg(vmsg, NULL, aptr->roomname); + vmsgnum = CtdlSubmitMsg(vmsg, NULL, aptr->roomname, QP_EADDR); CtdlFreeMessage(vmsg); } } diff --git a/citadel/msgbase.c b/citadel/msgbase.c index 8985cc684..28601e5be 100644 --- a/citadel/msgbase.c +++ b/citadel/msgbase.c @@ -1368,11 +1368,12 @@ void extract_encapsulated_message(char *name, char *filename, char *partnum, cha * */ 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 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 /* should the bessage be exported clean? */ ) { struct CtdlMessage *TheMessage = NULL; int retcode = om_no_such_msg; @@ -1444,7 +1445,7 @@ int CtdlOutputMsg(long msg_num, /* message number (local) to fetch */ } /* Ok, output the message now */ - retcode = CtdlOutputPreLoadedMsg(TheMessage, mode, headers_only, do_proto, crlf); + retcode = CtdlOutputPreLoadedMsg(TheMessage, mode, headers_only, do_proto, crlf, flags); CtdlFreeMessage(TheMessage); return(retcode); @@ -1571,7 +1572,8 @@ int CtdlOutputPreLoadedMsg( 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? */ + int crlf, /* Use CRLF newlines instead of LF? */ + int flags /* should the bessage be exported clean? */ ) { int i, j, k; char buf[SIZ]; @@ -1762,14 +1764,16 @@ int CtdlOutputPreLoadedMsg( safestrncpy(suser, mptr, sizeof suser); } else if (i == 'Y') { - mptr = qp_encode_email_addrs(mptr); + if (flags & QP_EADDR != 0) + mptr = qp_encode_email_addrs(mptr); cprintf("CC: %s%s", mptr, nl); } else if (i == 'P') { cprintf("Return-Path: %s%s", mptr, nl); } else if (i == 'V') { - mptr = qp_encode_email_addrs(mptr); + if (flags & QP_EADDR != 0) + mptr = qp_encode_email_addrs(mptr); cprintf("Envelope-To: %s%s", mptr, nl); } else if (i == 'U') { @@ -1795,7 +1799,8 @@ int CtdlOutputPreLoadedMsg( } else { - mptr = qp_encode_email_addrs(mptr); + if (flags & QP_EADDR != 0) + mptr = qp_encode_email_addrs(mptr); cprintf("To: %s%s", mptr, nl); } } @@ -2023,7 +2028,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); + CtdlOutputMsg(msgid, MT_CITADEL, headers_only, 1, 0, NULL, 0); return; } @@ -2039,7 +2044,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); + CtdlOutputMsg(msgid, MT_RFC822, headers_only, 1, 1, NULL, 0); } @@ -2093,7 +2098,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) ); + CtdlOutputMsg(msgid, MT_MIME, 0, 1, 0, (section[0] ? section : NULL) , 0); } @@ -2126,7 +2131,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); + CtdlOutputMsg(msgid, MT_DOWNLOAD, 0, 1, 1, NULL, 0); } @@ -2142,7 +2147,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); + CtdlOutputMsg(msgid, MT_SPEW_SECTION, 0, 1, 1, NULL, 0); } @@ -2524,8 +2529,9 @@ void ReplicationChecks(struct CtdlMessage *msg) { * Save a message to disk and submit it into the delivery system. */ long CtdlSubmitMsg(struct CtdlMessage *msg, /* message to save */ - struct recptypes *recps, /* recipients (if mail) */ - char *force /* force a particular room? */ + struct recptypes *recps, /* recipients (if mail) */ + char *force, /* force a particular room? */ + int flags /* should the bessage be exported clean? */ ) { char submit_filename[128]; char generated_timestamp[32]; @@ -2699,7 +2705,7 @@ long CtdlSubmitMsg(struct CtdlMessage *msg, /* message to save */ CCC->redirect_buffer = malloc(SIZ); CCC->redirect_len = 0; CCC->redirect_alloc = SIZ; - CtdlOutputPreLoadedMsg(msg, MT_RFC822, HEADERS_ALL, 0, 1); + CtdlOutputPreLoadedMsg(msg, MT_RFC822, HEADERS_ALL, 0, 1, QP_EADDR); smi.meta_rfc822_length = CCC->redirect_len; saved_rfc822_version = CCC->redirect_buffer; CCC->redirect_buffer = NULL; @@ -2782,7 +2788,7 @@ long CtdlSubmitMsg(struct CtdlMessage *msg, /* message to save */ imsg->cm_fields['J'] = strdup("do not journal"); imsg->cm_fields['M'] = instr; /* imsg owns this memory now */ imsg->cm_fields['W'] = strdup(recipient); - CtdlSubmitMsg(imsg, NULL, FNBL_QUEUE_ROOM); + CtdlSubmitMsg(imsg, NULL, FNBL_QUEUE_ROOM, 0); CtdlFreeMessage(imsg); } } @@ -2878,7 +2884,7 @@ long CtdlSubmitMsg(struct CtdlMessage *msg, /* message to save */ imsg->cm_fields['A'] = strdup("Citadel"); imsg->cm_fields['J'] = strdup("do not journal"); imsg->cm_fields['M'] = instr; /* imsg owns this memory now */ - CtdlSubmitMsg(imsg, NULL, SMTP_SPOOLOUT_ROOM); + CtdlSubmitMsg(imsg, NULL, SMTP_SPOOLOUT_ROOM, QP_EADDR); CtdlFreeMessage(imsg); } @@ -2982,7 +2988,7 @@ void quickie_message(char *from, char *fromaddr, char *to, char *room, char *tex } msg->cm_fields['M'] = strdup(text); - CtdlSubmitMsg(msg, recp, room); + CtdlSubmitMsg(msg, recp, room, 0); CtdlFreeMessage(msg); if (recp != NULL) free_recipients(recp); } @@ -3876,7 +3882,7 @@ void cmd_ent0(char *entargs) free(all_recps); if (msg != NULL) { - msgnum = CtdlSubmitMsg(msg, valid, ""); + msgnum = CtdlSubmitMsg(msg, valid, "", QP_EADDR); if (do_confirm) { cprintf("%ld\n", msgnum); @@ -4505,7 +4511,7 @@ void CtdlWriteObject(char *req_room, /* Room to stuff it in */ ); } /* Now write the data */ - CtdlSubmitMsg(msg, NULL, roomname); + CtdlSubmitMsg(msg, NULL, roomname, 0); CtdlFreeMessage(msg); } diff --git a/citadel/msgbase.h b/citadel/msgbase.h index 1c02bd686..f064dbbdd 100644 --- a/citadel/msgbase.h +++ b/citadel/msgbase.h @@ -99,7 +99,7 @@ void cmd_opna (char *cmdbuf); void cmd_dlat (char *cmdbuf); long send_message (struct CtdlMessage *); void loadtroom (void); -long CtdlSubmitMsg(struct CtdlMessage *, struct recptypes *, char *); +long CtdlSubmitMsg(struct CtdlMessage *, struct recptypes *, char *, int); void quickie_message (char *, char *, char *, char *, char *, int, char *); void cmd_ent0 (char *entargs); void cmd_dele (char *delstr); @@ -134,17 +134,22 @@ char *CtdlReadMessageBody(char *terminator, size_t maxlen, char *exist, int crlf char *CtdlGetSysConfig(char *sysconfname); void CtdlPutSysConfig(char *sysconfname, char *sysconfdata); 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 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? */ ); + +#define QP_EADDR (1<<0) +#define CRLF (1<<1) int CtdlOutputPreLoadedMsg(struct CtdlMessage *, - 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 */ + 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 */ + int flags /* should the bessage be exported clean? */ ); int CtdlCopyMsgsToRoom(long *msgnum, int num_msgs, char *dest); int CtdlDoIHavePermissionToDeleteMessagesFromThisRoom(void); -- 2.30.2