]> code.citadel.org Git - citadel.git/commitdiff
* Changes to auto-expunge algorithm to support correct behavior in
authorArt Cancro <ajc@citadel.org>
Fri, 19 Dec 2003 04:33:52 +0000 (04:33 +0000)
committerArt Cancro <ajc@citadel.org>
Fri, 19 Dec 2003 04:33:52 +0000 (04:33 +0000)
  some IMAP clients while moving messages.

citadel/ChangeLog
citadel/serv_imap.c
citadel/serv_imap.h

index c99743a89dd0e2335e759758c5d37fc09cdd7e10..465520691f7932afc6dc0e9088a14cd58d46271a 100644 (file)
@@ -1,4 +1,8 @@
  $Log$
+ Revision 613.1  2003/12/19 04:33:52  ajc
+ * Changes to auto-expunge algorithm to support correct behavior in
+   some IMAP clients while moving messages.
+
  Revision 613.0  2003/12/15 16:37:01  ajc
  * THIS IS 6.13
 
@@ -5161,4 +5165,3 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant <bryant@cs.usm.maine.edu>
 
 Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
        * Initial CVS import
-
index 175b04849965dde9af37283d4b9133ebf038712b..b2cfbba85bb92fe89a81f3925e9e4b4844c5a15e 100644 (file)
@@ -507,10 +507,13 @@ void imap_select(int num_parms, char *parms[]) {
        if (!ok) {
                cprintf("%s NO ... no such room, or access denied\r\n",
                        parms[0]);
-               IMAP->selected = 0;
+               /* IMAP->selected = 0; */
                return;
        }
 
+       /* If we already had some other folder selected, auto-expunge it */
+       imap_do_expunge();
+
        /*
         * usergoto() formally takes us to the desired room, happily returning
         * the number of messages and number of new messages.
@@ -530,9 +533,15 @@ void imap_select(int num_parms, char *parms[]) {
 
        cprintf("* %d EXISTS\r\n", msgs);
        cprintf("* %d RECENT\r\n", new);
+
+       /* Note that \Deleted is a valid flag, but not a permanent flag,
+        * because we don't maintain its state across sessions.  Citadel
+        * automatically expunges mailboxes when they are de-selected.
+        */
        cprintf("* FLAGS (\\Deleted \\Seen \\Answered)\r\n");
-       cprintf("* OK [PERMANENTFLAGS (\\Deleted \\Seen \\Answered)] "
+       cprintf("* OK [PERMANENTFLAGS (\\Seen \\Answered)] "
                "permanent flags\r\n");
+
        cprintf("* OK [UIDVALIDITY 0] UIDs valid\r\n");
        cprintf("%s OK [%s] %s completed\r\n",
                parms[0],
@@ -549,6 +558,9 @@ int imap_do_expunge(void) {
        int i;
        int num_expunged = 0;
 
+       lprintf(9, "imap_do_expunge() called\n");
+       if (IMAP->selected == 0) return(0);
+
        if (IMAP->num_msgs > 0) for (i=0; i<IMAP->num_msgs; ++i) {
                if (IMAP->flags[i] & IMAP_DELETED) {
                        CtdlDeleteMessages(CC->room.QRname,
@@ -1201,6 +1213,7 @@ void imap_command_loop(void) {
        }
 
        else if (!strcasecmp(parms[1], "LOGOUT")) {
+               imap_do_expunge();      /* yes, we auto-expunge */
                cprintf("* BYE %s logging out\r\n", config.c_fqdn);
                cprintf("%s OK thank you for using Citadel IMAP\r\n", parms[0]);
                CC->kill_me = 1;
index b5a536129454d17a58f444ecd9bc5585722be4d0..081bfb839a8e01edeee1e09020942fe350868422 100644 (file)
@@ -7,7 +7,7 @@ void imap_greeting(void);
 void imap_command_loop(void);
 int imap_grabroom(char *returned_roomname, char *foldername);
 void imap_free_transmitted_message(void);
-
+int imap_do_expunge(void);
 
 
 struct citimap {