free(jmsg->msgn);
/* Submit journal message */
- CtdlSubmitMsg(journal_msg, journal_recps, "");
+ CtdlSubmitMsg(journal_msg, journal_recps, "", 0);
CtdlFreeMessage(journal_msg);
}
strcat(msg->cm_fields['M'], ser);
/* Now write the data */
- CtdlSubmitMsg(msg, NULL, "");
+ CtdlSubmitMsg(msg, NULL, "", QP_EADDR);
CtdlFreeMessage(msg);
}
if (msg != NULL) {
valid = validate_recipients(organizer_string, NULL, 0);
- CtdlSubmitMsg(msg, valid, "");
+ CtdlSubmitMsg(msg, valid, "", QP_EADDR);
CtdlFreeMessage(msg);
free_recipients(valid);
}
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;
}
if (msg != NULL) {
valid = validate_recipients(attendees_string, NULL, 0);
- CtdlSubmitMsg(msg, valid, "");
+ CtdlSubmitMsg(msg, valid, "", QP_EADDR);
CtdlFreeMessage(msg);
free_recipients(valid);
}
* 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)) {
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;
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;
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;
}
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);
}
/*
* 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);
}
* 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);
}
/*
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;
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",
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) {
/* 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);
}
/* 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. */
}
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);
msg->cm_fields['R'] = strdup(nptr->name);
valid = validate_recipients(nptr->name, NULL, 0);
- CtdlSubmitMsg(msg, valid, "");
+ CtdlSubmitMsg(msg, valid, "", 0);
free_recipients(valid);
}
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);
/* 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);
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;
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;
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;
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 */
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 */
return SIEVE2_ERROR_BADARGS;
}
- CtdlSubmitMsg(msg, valid, NULL);
+ CtdlSubmitMsg(msg, valid, NULL, 0);
cs->cancel_implicit_keep = 1;
free_recipients(valid);
CtdlFreeMessage(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);
my.rfc822headers = CC->redirect_buffer;
headers_len = CC->redirect_len;
CC->redirect_buffer = NULL;
}
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");
}
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;
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;
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 */
"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);
}
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;
msg->cm_fields['S'] = strdup("CANCEL");
- CtdlSubmitMsg(msg, NULL, ADDRESS_BOOK_ROOM);
+ CtdlSubmitMsg(msg, NULL, ADDRESS_BOOK_ROOM, QP_EADDR);
CtdlFreeMessage(msg);
}
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);
}
}
*
*/
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;
}
/* 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);
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];
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') {
}
else
{
- mptr = qp_encode_email_addrs(mptr);
+ if (flags & QP_EADDR != 0)
+ mptr = qp_encode_email_addrs(mptr);
cprintf("To: %s%s", mptr, nl);
}
}
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;
}
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);
}
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);
}
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);
}
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);
}
* 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];
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;
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);
}
}
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);
}
}
msg->cm_fields['M'] = strdup(text);
- CtdlSubmitMsg(msg, recp, room);
+ CtdlSubmitMsg(msg, recp, room, 0);
CtdlFreeMessage(msg);
if (recp != NULL) free_recipients(recp);
}
free(all_recps);
if (msg != NULL) {
- msgnum = CtdlSubmitMsg(msg, valid, "");
+ msgnum = CtdlSubmitMsg(msg, valid, "", QP_EADDR);
if (do_confirm) {
cprintf("%ld\n", msgnum);
);
}
/* Now write the data */
- CtdlSubmitMsg(msg, NULL, roomname);
+ CtdlSubmitMsg(msg, NULL, roomname, 0);
CtdlFreeMessage(msg);
}
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);
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);