*/
ch = *mptr++;
if (ch != 255) {
- lprintf(CTDL_ERR,
- "Message %ld appears to be corrupted.\n",
- msgnum);
+ lprintf(CTDL_ERR, "Message %ld appears to be corrupted.\n", msgnum);
cdb_free(dmsgtext);
return NULL;
}
* we've already printed another section, skip this one.
*/
if ( (ma->is_ma) && (ma->did_print) ) {
- lprintf(CTDL_DEBUG, "Skipping part %s (%s)\n",
- partnum, cbtype);
+ lprintf(CTDL_DEBUG, "Skipping part %s (%s)\n", partnum, cbtype);
return;
}
ma->did_print = 1;
ma = (struct ma_info *)cbuserdata;
- if (ma->is_ma > 0) {
- for (i=0; i<num_tokens(CC->preferred_formats, '|'); ++i) {
- extract_token(buf, CC->preferred_formats, i, '|', sizeof buf);
- if ( (!strcasecmp(buf, cbtype)) && (!ma->freeze) ) {
- if (i < ma->chosen_pref) {
- safestrncpy(ma->chosen_part, partnum, sizeof ma->chosen_part);
- ma->chosen_pref = i;
- }
+ // NOTE: REMOVING THIS CONDITIONAL FIXES BUG 220
+ // http://bugzilla.citadel.org/show_bug.cgi?id=220
+ // I don't know if there are any side effects! Please TEST TEST TEST
+ //if (ma->is_ma > 0) {
+
+ for (i=0; i<num_tokens(CC->preferred_formats, '|'); ++i) {
+ extract_token(buf, CC->preferred_formats, i, '|', sizeof buf);
+ if ( (!strcasecmp(buf, cbtype)) && (!ma->freeze) ) {
+ if (i < ma->chosen_pref) {
+ lprintf(CTDL_DEBUG, "Setting chosen part: <%s>\n", partnum);
+ safestrncpy(ma->chosen_part, partnum, sizeof ma->chosen_part);
+ ma->chosen_pref = i;
}
}
}
}
/* Ok, output the message now */
- retcode = CtdlOutputPreLoadedMsg(
- TheMessage, mode,
- headers_only, do_proto, crlf);
+ retcode = CtdlOutputPreLoadedMsg(TheMessage, mode, headers_only, do_proto, crlf);
CtdlFreeMessage(TheMessage);
return(retcode);
/*
* Get a message off disk. (returns om_* values found in msgbase.h)
- *
*/
int CtdlOutputPreLoadedMsg(
struct CtdlMessage *TheMessage,
* what message transfer format is in use.
*/
if (TheMessage->cm_format_type == FMT_FIXED) {
+ int buflen;
if (mode == MT_MIME) {
cprintf("Content-type: text/plain\n\n");
}
- strcpy(buf, "");
+ *buf = '\0';
+ buflen = 0;
while (ch = *mptr++, ch > 0) {
if (ch == 13)
ch = 10;
- if ((ch == 10) || (strlen(buf) > 250)) {
+ if ((ch == 10) || (buflen > 250)) {
+ buf[buflen] = '\0';
cprintf("%s%s", buf, nl);
- strcpy(buf, "");
+ *buf = '\0';
+ buflen = 0;
} else {
- buf[strlen(buf) + 1] = 0;
- buf[strlen(buf)] = ch;
+ buf[buflen] = ch;
+ buflen++;
}
}
+ buf[buflen] = '\0';
if (!IsEmptyStr(buf))
cprintf("%s%s", buf, nl);
}
}
+/*
+ * Serialize a struct CtdlMessage into the format used on disk and network.
+ *
+ * This function loads up a "struct ser_ret" (defined in server.h) which
+ * contains the length of the serialized message and a pointer to the
+ * serialized message in memory. THE LATTER MUST BE FREED BY THE CALLER.
+ */
+void dump_message(struct CtdlMessage *msg, /* unserialized msg */
+ long Siz) /* how many chars ? */
+{
+ size_t wlen;
+ int i;
+ static char *forder = FORDER;
+ char *buf;
+
+ /*
+ * Check for valid message format
+ */
+ if (is_valid_message(msg) == 0) {
+ lprintf(CTDL_ERR, "dump_message() aborting due to invalid message\n");
+ return;
+ }
+
+ buf = (char*) malloc (Siz + 1);
+
+ wlen = 3;
+
+ for (i=0; i<26; ++i) if (msg->cm_fields[(int)forder[i]] != NULL) {
+ snprintf (buf, Siz, " msg[%c] = %s ...\n", (char) forder[i],
+ msg->cm_fields[(int)forder[i]]);
+ client_write (buf, strlen(buf));
+ }
+
+ return;
+}
+
+
/*
* Check to see if any messages already exist in the current room which
MailboxName(actual_rm, sizeof actual_rm, &userbuf, MAILROOM);
CtdlSaveMsgPointerInRoom(actual_rm, newmsgid, 0, msg);
BumpNewMailCounter(userbuf.usernum);
- if (!IsEmptyStr(config.c_funambol_host)) {
+ if (!IsEmptyStr(config.c_funambol_host) || !IsEmptyStr(config.c_pager_program)) {
/* Generate a instruction message for the Funambol notification
* server, in the same style as the SMTP queue
*/
mailtype = alias(this_recp);
mailtype = alias(this_recp);
mailtype = alias(this_recp);
+ j = 0;
for (j=0; !IsEmptyStr(&this_recp[j]); ++j) {
if (this_recp[j]=='_') {
this_recp_cooked[j] = ' ';
this_recp_cooked[j] = this_recp[j];
}
}
+ this_recp_cooked[j] = '\0';
invalid = 0;
switch(mailtype) {
case MES_LOCAL: