X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=citadel%2Fmodules%2Fimap%2Fimap_store.c;h=429f8edbb980c8162eb9bd62b068f14e07c425e3;hb=7a9b0685e406cc83597171cc39d008c7e5459ca8;hp=4b2f1b45d30d2cd8d20ad2624c564dc973c73f0d;hpb=6ab0a033e52ed0e31feadec942f3d2c4dc8040b1;p=citadel.git diff --git a/citadel/modules/imap/imap_store.c b/citadel/modules/imap/imap_store.c index 4b2f1b45d..429f8edbb 100644 --- a/citadel/modules/imap/imap_store.c +++ b/citadel/modules/imap/imap_store.c @@ -1,11 +1,9 @@ /* - * $Id$ - * * Implements the STORE command in IMAP. * * Copyright (c) 2001-2009 by the citadel.org team * - * This program is free software; you can redistribute it and/or modify + * This program is open source software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. @@ -30,18 +28,7 @@ #include #include #include - -#if TIME_WITH_SYS_TIME -# include -# include -#else -# if HAVE_SYS_TIME_H -# include -# else -# include -# endif -#endif - +#include #include #include #include @@ -55,10 +42,11 @@ #include "config.h" #include "user_ops.h" #include "database.h" +#include "room_ops.h" #include "msgbase.h" #include "internet_addressing.h" -#include "imap_tools.h" #include "serv_imap.h" +#include "imap_tools.h" #include "imap_fetch.h" #include "imap_store.h" #include "genstamp.h" @@ -71,17 +59,17 @@ * We also implement the ".SILENT" protocol option here. :( */ void imap_do_store_msg(int seq, const char *oper, unsigned int bits_to_twiddle) { - + citimap *Imap = IMAP; if (!strncasecmp(oper, "FLAGS", 5)) { - IMAP->flags[seq] &= IMAP_MASK_SYSTEM; - IMAP->flags[seq] |= bits_to_twiddle; + Imap->flags[seq] &= IMAP_MASK_SYSTEM; + Imap->flags[seq] |= bits_to_twiddle; } else if (!strncasecmp(oper, "+FLAGS", 6)) { - IMAP->flags[seq] |= bits_to_twiddle; + Imap->flags[seq] |= bits_to_twiddle; } else if (!strncasecmp(oper, "-FLAGS", 6)) { - IMAP->flags[seq] &= (~bits_to_twiddle); + Imap->flags[seq] &= (~bits_to_twiddle); } } @@ -164,9 +152,9 @@ void imap_do_store(citimap_command *Cmd) { imap_do_store_msg(i, oper, bits_to_twiddle); if (!silent) { - cprintf("* %d FETCH (", i+1); + IAPrintf("* %d FETCH (", i+1); imap_fetch_flags(i); - cprintf(")\r\n"); + IAPuts(")\r\n"); } } @@ -197,15 +185,8 @@ void imap_do_store(citimap_command *Cmd) { } free(ss_msglist); - - /* - * The following two commands implement "instant expunge" if enabled. - */ - if (config.c_instant_expunge) { - imap_do_expunge(); - imap_rescan_msgids(); - } - + imap_do_expunge(); // Citadel always expunges immediately. + imap_rescan_msgids(); } @@ -217,7 +198,7 @@ void imap_store(int num_parms, ConstStr *Params) { int num_items; if (num_parms < 3) { - cprintf("%s BAD invalid parameters\r\n", Params[0].Key); + IReply("BAD invalid parameters"); return; } @@ -225,7 +206,7 @@ void imap_store(int num_parms, ConstStr *Params) { imap_pick_range(Params[2].Key, 0); } else { - cprintf("%s BAD invalid parameters\r\n", Params[0].Key); + IReply("BAD invalid parameters"); return; } @@ -235,14 +216,14 @@ void imap_store(int num_parms, ConstStr *Params) { num_items = imap_extract_data_items(&Cmd); if (num_items < 1) { - cprintf("%s BAD invalid data item list\r\n", Params[0].Key); + IReply("BAD invalid data item list"); FreeStrBuf(&Cmd.CmdBuf); free(Cmd.Params); return; } imap_do_store(&Cmd); - cprintf("%s OK STORE completed\r\n", Params[0].Key); + IReply("OK STORE completed"); FreeStrBuf(&Cmd.CmdBuf); free(Cmd.Params); } @@ -255,7 +236,7 @@ void imap_uidstore(int num_parms, ConstStr *Params) { int num_items; if (num_parms < 4) { - cprintf("%s BAD invalid parameters\r\n", Params[0].Key); + IReply("BAD invalid parameters"); return; } @@ -263,7 +244,7 @@ void imap_uidstore(int num_parms, ConstStr *Params) { imap_pick_range(Params[3].Key, 1); } else { - cprintf("%s BAD invalid parameters\r\n", Params[0].Key); + IReply("BAD invalid parameters"); return; } @@ -273,14 +254,14 @@ void imap_uidstore(int num_parms, ConstStr *Params) { num_items = imap_extract_data_items(&Cmd); if (num_items < 1) { - cprintf("%s BAD invalid data item list\r\n", Params[0].Key); + IReply("BAD invalid data item list"); FreeStrBuf(&Cmd.CmdBuf); free(Cmd.Params); return; } imap_do_store(&Cmd); - cprintf("%s OK UID STORE completed\r\n", Params[0].Key); + IReply("OK UID STORE completed"); FreeStrBuf(&Cmd.CmdBuf); free(Cmd.Params); }