* make QP encoding of senders optional, so we can flag it if we need it.
authorWilfried Göesgens <willi@citadel.org>
Sat, 24 May 2008 14:37:02 +0000 (14:37 +0000)
committerWilfried Göesgens <willi@citadel.org>
Sat, 24 May 2008 14:37:02 +0000 (14:37 +0000)
18 files changed:
citadel/journaling.c
citadel/modules/calendar/serv_calendar.c
citadel/modules/chat/serv_chat.c
citadel/modules/dspam/serv_dspam.c
citadel/modules/fulltext/serv_fulltext.c
citadel/modules/imap/imap_fetch.c
citadel/modules/imap/imap_misc.c
citadel/modules/imap/imap_search.c
citadel/modules/network/serv_network.c
citadel/modules/pop3/serv_pop3.c
citadel/modules/pop3client/serv_pop3client.c
citadel/modules/rssclient/serv_rssclient.c
citadel/modules/sieve/serv_sieve.c
citadel/modules/smtp/serv_smtp.c
citadel/modules/spam/serv_spam.c
citadel/modules/vcard/serv_vcard.c
citadel/msgbase.c
citadel/msgbase.h

index 9fc8246ea3e0478559fc8878677486d78d6d54df..6f5e69644378160c181c0901c53afb31bf9d040a 100644 (file)
@@ -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);
                }
 
index cc134e0d1a721623ca9e06b623a4ef78e66fa576..e9a96e5f0e9da9742b624816650112aec890239c 100644 (file)
@@ -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);
                }
index afc03dbb4358cd6dd4c33b283e1e1132f884e425..2cf3bb233da43313ae483ffc938af174f9dca7be 100644 (file)
@@ -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)) {
index e0f478f6c79042cdf80541004ec6b1943d073482..1c0c0d7c4e9933669a5a3913710cf192361f7775 100644 (file)
@@ -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;
index 131c5225622c173ed0d749adfd80bd630bf531f2..5147bad198aadbd11915991daaee3960f25fbe02 100644 (file)
@@ -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;
index bff79381e14cc6283a77c013ae0a3756a474f29c..436a4b243857d8c6bcee53635911e00c45cc8a6b 100644 (file)
@@ -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;
index 9b15e4208af09f8f4f80752149fc6ff5919073c5..be350a5721c572294e8b34363bc58927875c4baf 100644 (file)
@@ -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",
index 7efc71ed6cd5db87d4f9aaddfd79fcfc9cbf687b..661a9001d60dade67ca3aa65062f22aa30ba43e6 100644 (file)
@@ -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) {
index 9258f3c9f371066f2386f6885579d736fd3d2667..969cefed2ca85026836a266eccd0db7947d5a9be 100644 (file)
@@ -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);
index e839f5ec9c6e4c72c0148069ed759206c96211e6..43a2545d871d81e747c3347cceadce6d545363d1 100644 (file)
@@ -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;
index 8015bd758b552d8c92ec527e95aade4b57587054..e27971000639e1c96b411b88b838e52637c97073 100644 (file)
@@ -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 */
        
index 4db28dbb5d3d82498dfebe2c3d80fb0974117e8d..c356e9d5478d18c2361d5e948715f86946de060e 100644 (file)
@@ -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 */
index 0006604f32b040d017ccb8a68a07e5ded3aa8351..e8156501b35b6d436727485cf2ea0e2ca3de72ef 100644 (file)
@@ -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;
index 43d2de624bc99af757c4ecc29e63277e4e61a783..fada0bf9880fb2a7700643552b0bd16d48511b92 100644 (file)
@@ -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);
        }
 
index e8549ee4a8575698724b23bf76134ea9f998b652..249f52e3e23e1269ca82db29dedce793bd40548d 100644 (file)
@@ -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;
index 7180cd668229ebb623a37b71dd5667fbb5cd429b..2175cf0b9e8e739a559294677171a3c51e2f81ff 100644 (file)
@@ -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);
                }
        }
index 8985cc6847ab03d8a5eda952adff87654d169d1a..28601e5bebd4b122e4353fac637fd15b78012c26 100644 (file)
@@ -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);
 }
 
index 1c02bd68630d93220a2ffb4728d629c97fba136b..f064dbbddea66741133bf70584a1dfce2253becb 100644 (file)
@@ -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);