]> code.citadel.org Git - citadel.git/blobdiff - citadel/imap_store.c
* Renamed "dynloader" to "serv_extensions" globally. We don't want people
[citadel.git] / citadel / imap_store.c
index 921648acccff5c93744d58b7e2846dfd09e68f2f..e3ce69b5bd6ddc5758bc8e910da9ee7c130f7057 100644 (file)
 #include <pwd.h>
 #include <errno.h>
 #include <sys/types.h>
-#include <sys/time.h>
+
+#if TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+
 #include <sys/wait.h>
 #include <ctype.h>
 #include <string.h>
 #include <limits.h>
 #include "citadel.h"
 #include "server.h"
-#include <time.h>
 #include "sysdep_decls.h"
 #include "citserver.h"
 #include "support.h"
 #include "config.h"
-#include "dynloader.h"
+#include "serv_extensions.h"
 #include "room_ops.h"
 #include "user_ops.h"
 #include "policy.h"
@@ -63,6 +73,11 @@ void imap_do_store_msg(int seq, char *oper, unsigned int bits_to_twiddle) {
                IMAP->flags[seq] &= (~bits_to_twiddle);
        }
 
+       if (bits_to_twiddle & IMAP_SEEN) {
+               CtdlSetSeen(IMAP->msgids[seq],
+                               ((IMAP->flags[seq] & IMAP_SEEN) ? 1 : 0) );
+       }
+
        cprintf("* %d FETCH (", seq+1);
        imap_fetch_flags(seq);
        cprintf(")\r\n");
@@ -91,7 +106,13 @@ void imap_do_store(int num_items, char **itemlist) {
                striplt(flag);
 
                if (!strcasecmp(flag, "\\Deleted")) {
+                 if (CtdlDoIHavePermissionToDeleteMessagesFromThisRoom()) {
                        bits_to_twiddle |= IMAP_DELETED;
+                 }
+               }
+
+               if (!strcasecmp(flag, "\\Seen")) {
+                       bits_to_twiddle |= IMAP_SEEN;
                }
        }