2007-08-08 [colin] 2.10.0cvs101
authorColin Leroy <colin@colino.net>
Wed, 8 Aug 2007 16:10:02 +0000 (16:10 +0000)
committerColin Leroy <colin@colino.net>
Wed, 8 Aug 2007 16:10:02 +0000 (16:10 +0000)
* src/imap.c
* src/etpan/imap-thread.c
* src/etpan/imap-thread.h
Close selected mailbox before doing
status on it.

ChangeLog
PATCHSETS
configure.ac
src/etpan/imap-thread.c
src/etpan/imap-thread.h
src/imap.c

index e03ca727557c8ce76d341d46460c0c4498e2514b..e71944b1c8faa37118d7584c7af065299fa9ad56 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2007-08-08 [colin]     2.10.0cvs101
+
+       * src/imap.c
+       * src/etpan/imap-thread.c
+       * src/etpan/imap-thread.h
+               Close selected mailbox before doing
+               status on it.
+
 2007-08-08 [colin]     2.10.0cvs100
 
        * src/html.c
index 932c662b128bed612e85563573a03c75814756d7..08b7c658facc9180e47614e26b29bfc735909844 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.179.2.177 -r 1.179.2.178 src/imap.c;  cvs diff -u -r 1.94.2.143 -r 1.94.2.144 src/messageview.c;  cvs diff -u -r 1.16.2.53 -r 1.16.2.54 src/msgcache.c;  ) > 2.10.0cvs98.patchset
 ( cvs diff -u -r 1.179.2.178 -r 1.179.2.179 src/imap.c;  ) > 2.10.0cvs99.patchset
 ( cvs diff -u -r 1.12.2.21 -r 1.12.2.22 src/html.c;  cvs diff -u -r 1.16.2.54 -r 1.16.2.55 src/msgcache.c;  ) > 2.10.0cvs100.patchset
+( cvs diff -u -r 1.179.2.179 -r 1.179.2.180 src/imap.c;  cvs diff -u -r 1.1.4.80 -r 1.1.4.81 src/etpan/imap-thread.c;  cvs diff -u -r 1.1.4.17 -r 1.1.4.18 src/etpan/imap-thread.h;  ) > 2.10.0cvs101.patchset
index a7bdb2f6b3f523aab19c6746ebba6b7981763b94..463bb2bc7e6e9c2331ff55770099161a97a410b2 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=10
 MICRO_VERSION=0
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=100
+EXTRA_VERSION=101
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index ca3512d71da5d3e4ef711fbe4f1f118dcc195c87..ddb6757ac8a020ea9f875e41f4ee51367dac8448 100644 (file)
@@ -1297,7 +1297,43 @@ int imap_threaded_select(Folder * folder, const char * mb,
        return result.error;
 }
 
+static void close_run(struct etpan_thread_op * op)
+{
+       struct select_param * param;
+       struct select_result * result;
+       int r;
+       
+       param = op->param;
+       result = op->result;
 
+       CHECK_IMAP();
+
+       r = mailimap_close(param->imap);
+       
+       result->error = r;
+       debug_print("imap close run - end %i\n", r);
+}
+
+int imap_threaded_close(Folder * folder)
+{
+       struct select_param param;
+       struct select_result result;
+       mailimap * imap;
+       
+       debug_print("imap close - begin\n");
+       
+       imap = get_imap(folder);
+       param.imap = imap;
+       
+       threaded_run(folder, &param, &result, close_run);
+       
+       if (result.error != MAILIMAP_NO_ERROR)
+               return result.error;
+       
+       debug_print("imap close - end\n");
+       
+       return result.error;
+}
 
 struct examine_param {
        mailimap * imap;
index dbecaa4bd60da9eb3500583e278a80dd2d7dcf6f..bf5db3b9d4b2301b2b828a85d0e1ea049a2b8f64 100644 (file)
@@ -53,6 +53,7 @@ int imap_threaded_login(Folder * folder,
 int imap_threaded_status(Folder * folder, const char * mb,
                struct mailimap_mailbox_data_status ** data_status,
                guint mask);
+int imap_threaded_close(Folder * folder);
 
 int imap_threaded_noop(Folder * folder, unsigned int * p_exists);
 int imap_threaded_starttls(Folder * folder, const gchar *host, int port);
index ce86d94e6beafd55b42fbfc1950dce4a65e3369f..265f17e5e4ba39ea3628ac01e16547a621efea42 100644 (file)
@@ -327,6 +327,7 @@ static gint imap_cmd_select (IMAPSession    *session,
                                 gint           *unseen,
                                 guint32        *uid_validity,
                                 gboolean        block);
+static gint imap_cmd_close     (IMAPSession    *session);
 static gint imap_cmd_examine   (IMAPSession    *session,
                                 const gchar    *folder,
                                 gint           *exists,
@@ -2839,6 +2840,16 @@ static gint imap_status(IMAPSession *session, IMAPFolder *folder,
                mask |= 1 << 4;
                *unseen = 0;
        }
+       
+       if (session->mbox != NULL &&
+           !strcmp(session->mbox, item->item.path)) {
+               r = imap_cmd_close(session);
+               if (r != MAILIMAP_NO_ERROR) {
+                       debug_print("close err %d\n", r);
+                       return IMAP_ERROR;
+               }
+       }
+       
        r = imap_threaded_status(FOLDER(folder), real_path, 
                &data_status, mask);
 
@@ -3008,6 +3019,20 @@ static gint imap_cmd_select(IMAPSession *session, const gchar *folder,
        return IMAP_SUCCESS;
 }
 
+static gint imap_cmd_close(IMAPSession *session)
+{
+       int r;
+
+       r = imap_threaded_close(session->folder);
+       if (r != MAILIMAP_NO_ERROR) {
+               debug_print("close err %d\n", r);
+               return IMAP_ERROR;
+       }
+       g_free(session->mbox);
+       session->mbox = NULL;
+       return IMAP_SUCCESS;
+}
+
 static gint imap_cmd_examine(IMAPSession *session, const gchar *folder,
                             gint *exists, gint *recent, gint *unseen,
                             guint32 *uid_validity, gboolean block)