X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=citadel%2Fmsgbase.c;h=1a1f984f1aa6368ddf770f9307bbb0bb59443e97;hb=8896f6d392af58e432577e100353f5ffb4d02e21;hp=b6155e9818e48a79ca201708102f561128acbab2;hpb=8ce9bb758f83abb5da6be3c6b9500df59509d6fd;p=citadel.git diff --git a/citadel/msgbase.c b/citadel/msgbase.c index b6155e981..1a1f984f1 100644 --- a/citadel/msgbase.c +++ b/citadel/msgbase.c @@ -52,6 +52,11 @@ #include "euidindex.h" #include "journaling.h" #include "citadel_dirs.h" +#include "serv_network.h" + +#ifdef HAVE_LIBSIEVE +# include "serv_sieve.h" +#endif /* HAVE_LIBSIEVE */ long config_msgnum; struct addresses_to_be_filed *atbf = NULL; @@ -611,7 +616,7 @@ int CtdlForEachMessage(int mode, long ref, char *search_string, for (i=0; ichosen_part + * and then set ma->chosen_pref to that MIME type's position in our preference + * list. If we then hit another match, we only replace the first match if + * the preference value is lower. */ void choose_preferred(char *name, char *filename, char *partnum, char *disp, void *content, char *cbtype, char *cbcharset, size_t length, @@ -1218,8 +1229,12 @@ void choose_preferred(char *name, char *filename, char *partnum, char *disp, if (ma->is_ma > 0) { for (i=0; ipreferred_formats, '|'); ++i) { extract_token(buf, CC->preferred_formats, i, '|', sizeof buf); + lprintf(CTDL_DEBUG, "Is <%s> == <%s> ??\n", buf, cbtype); if ( (!strcasecmp(buf, cbtype)) && (!ma->freeze) ) { - safestrncpy(ma->chosen_part, partnum, sizeof ma->chosen_part); + if (i < ma->chosen_pref) { + safestrncpy(ma->chosen_part, partnum, sizeof ma->chosen_part); + ma->chosen_pref = i; + } } } } @@ -1579,6 +1594,12 @@ int CtdlOutputPreLoadedMsg( else if (i == 'Y') { cprintf("CC: %s%s", mptr, nl); } + else if (i == 'P') { + cprintf("Return-Path: %s%s", mptr, nl); + } + else if (i == 'V') { + cprintf("Envelope-To: %s%s", mptr, nl); + } else if (i == 'U') { cprintf("Subject: %s%s", mptr, nl); subject_found = 1; @@ -1755,6 +1776,7 @@ START_TEXT: if (mode == MT_MIME) { ma.use_fo_hooks = 0; strcpy(ma.chosen_part, "1"); + ma.chosen_pref = 9999; mime_parser(mptr, NULL, *choose_preferred, *fixed_output_pre, *fixed_output_post, (void *)&ma, 0); @@ -2032,6 +2054,16 @@ int CtdlSaveMsgPointersInRoom(char *roomname, long newmsgidlist[], int num_newms lprintf(CTDL_DEBUG, "CtdlSaveMsgPointerInRoom() skips repl checks\n"); } + /* Submit this room for net processing */ + network_queue_room(&CC->room, NULL); + +#ifdef HAVE_LIBSIEVE + /* If this is someone's inbox, submit the room for sieve processing */ + if (!strcasecmp(&CC->room.QRname[11], MAILROOM)) { + sieve_queue_room(&CC->room); + } +#endif /* HAVE_LIBSIEVE */ + /* Go back to the room we were in before we wandered here... */ getroom(&CC->room, hold_rm); @@ -2615,7 +2647,7 @@ long CtdlSubmitMsg(struct CtdlMessage *msg, /* message to save */ /* * Convenience function for generating small administrative messages. */ -void quickie_message(char *from, char *to, char *room, char *text, +void quickie_message(char *from, char *fromaddr, char *to, char *room, char *text, int format_type, char *subject) { struct CtdlMessage *msg; @@ -2626,7 +2658,21 @@ void quickie_message(char *from, char *to, char *room, char *text, msg->cm_magic = CTDLMESSAGE_MAGIC; msg->cm_anon_type = MES_NORMAL; msg->cm_format_type = format_type; - msg->cm_fields['A'] = strdup(from); + + if (from != NULL) { + msg->cm_fields['A'] = strdup(from); + } + else if (fromaddr != NULL) { + msg->cm_fields['A'] = strdup(fromaddr); + if (strchr(msg->cm_fields['A'], '@')) { + *strchr(msg->cm_fields['A'], '@') = 0; + } + } + else { + msg->cm_fields['A'] = strdup("Citadel"); + } + + if (fromaddr != NULL) msg->cm_fields['F'] = strdup(fromaddr); if (room != NULL) msg->cm_fields['O'] = strdup(room); msg->cm_fields['N'] = strdup(NODENAME); if (to != NULL) {