2005-07-10 [hoa] 1.9.12cvs33
authorHoà Viêt Dinh <dinh.viet.hoa@free.fr>
Sun, 10 Jul 2005 23:37:45 +0000 (23:37 +0000)
committerHoà Viêt Dinh <dinh.viet.hoa@free.fr>
Sun, 10 Jul 2005 23:37:45 +0000 (23:37 +0000)
* src/etpan/imap-thread.c
workaround for old Courier IMAP servers.

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

index 77fed23..8fede23 100644 (file)
@@ -1,3 +1,8 @@
+2005-07-10 [hoa]       1.9.12cvs33
+
+       * src/etpan/imap-thread.c
+               workaround for old Courier IMAP servers.
+
 2005-07-10 [colin]     1.9.12cvs32
 
        * src/folder.c
index 2356d47..4f2d47e 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.96.2.60 -r 1.96.2.61 src/textview.c;  cvs diff -u -r 1.8.2.5 -r 1.8.2.6 src/unmime.c;  cvs diff -u -r 1.2.2.9 -r 1.2.2.10 src/gtk/inputdialog.c;  ) > 1.9.12cvs30.patchset
 ( cvs diff -u -r 1.179.2.51 -r 1.179.2.52 src/imap.c;  cvs diff -u -r 1.1.4.4 -r 1.1.4.5 src/etpan/imap-thread.c;  ) > 1.9.12cvs31.patchset
 ( cvs diff -u -r 1.213.2.40 -r 1.213.2.41 src/folder.c;  cvs diff -u -r 1.179.2.52 -r 1.179.2.53 src/imap.c;  cvs diff -u -r 1.34.2.1 -r 1.34.2.2 src/imap.h;  cvs diff -u -r 1.5.2.4 -r 1.5.2.5 src/statusbar.c;  cvs diff -u -r 1.3.2.1 -r 1.3.2.2 src/statusbar.h;  cvs diff -u -r 1.1.4.5 -r 1.1.4.6 src/etpan/imap-thread.c;  ) > 1.9.12cvs32.patchset
+( cvs diff -u -r 1.1.4.6 -r 1.1.4.7 src/etpan/imap-thread.c;  ) > 1.9.12cvs33.patchset
index aba63fc..dc3ebb0 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=9
 MICRO_VERSION=12
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=32
+EXTRA_VERSION=33
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index 5b49285..28d9aed 100644 (file)
@@ -16,6 +16,7 @@
 #include "etpan-thread-manager.h"
 
 static struct etpan_thread_manager * thread_manager = NULL;
+static chash * courier_workaround_hash = NULL;
 static chash * imap_hash = NULL;
 static chash * session_hash = NULL;
 static guint thread_manager_signal = 0;
@@ -46,6 +47,7 @@ void imap_main_init(void)
 #endif
        imap_hash = chash_new(CHASH_COPYKEY, CHASH_DEFAULTSIZE);
        session_hash = chash_new(CHASH_COPYKEY, CHASH_DEFAULTSIZE);
+       courier_workaround_hash = chash_new(CHASH_COPYKEY, CHASH_DEFAULTSIZE);
        
        thread_manager = etpan_thread_manager_new();
        
@@ -75,6 +77,7 @@ void imap_main_done(void)
        
        etpan_thread_manager_free(thread_manager);
        
+       chash_free(courier_workaround_hash);
        chash_free(session_hash);
        chash_free(imap_hash);
 }
@@ -342,6 +345,10 @@ void imap_threaded_disconnect(Folder * folder)
        value.len = 0;
        chash_delete(session_hash, &key, NULL);
        
+       key.data = &imap;
+       key.len = sizeof(imap);
+       chash_delete(courier_workaround_hash, &key, NULL);
+       
        mailimap_free(imap);
        
        debug_print("disconnect ok\n");
@@ -1114,6 +1121,7 @@ static void fetch_uid_run(struct etpan_thread_op * op)
        
        param = op->param;
        
+       fetch_result = NULL;
        r = imap_get_messages_list(param->imap, param->first_index,
                                   &fetch_result);
        
@@ -1655,6 +1663,18 @@ int imap_add_envelope_fetch_att(struct mailimap_fetch_type * fetch_type)
        return MAIL_NO_ERROR;
 }
 
+int imap_add_header_fetch_att(struct mailimap_fetch_type * fetch_type)
+{
+       struct mailimap_fetch_att * fetch_att;
+       struct mailimap_section * section;
+       
+       section = mailimap_section_new_header();
+       fetch_att = mailimap_fetch_att_new_body_peek_section(section);
+       mailimap_fetch_type_new_fetch_att_list_add(fetch_type, fetch_att);
+       
+       return MAIL_NO_ERROR;
+}
+
 static int
 imap_get_envelopes_list(mailimap * imap, struct mailimap_set * set,
                        carray ** p_env_list)
@@ -1665,6 +1685,8 @@ imap_get_envelopes_list(mailimap * imap, struct mailimap_set * set,
        clist * fetch_result;
        int r;
        carray * env_list;
+       chashdatum key;
+       chashdatum value;
        
        fetch_type = mailimap_fetch_type_new_fetch_att_list_empty();
   
@@ -1681,7 +1703,13 @@ imap_get_envelopes_list(mailimap * imap, struct mailimap_set * set,
        r = mailimap_fetch_type_new_fetch_att_list_add(fetch_type, fetch_att);
   
        /* headers */
-       r = imap_add_envelope_fetch_att(fetch_type);
+       key.data = &imap;
+       key.len = sizeof(imap);
+       r = chash_get(courier_workaround_hash, &key, &value);
+       if (r < 0)
+               r = imap_add_envelope_fetch_att(fetch_type);
+       else
+               r = imap_add_header_fetch_att(fetch_type);
        
        r = mailimap_uid_fetch(imap, set, fetch_type, &fetch_result);
        
@@ -1736,6 +1764,7 @@ static void fetch_env_run(struct etpan_thread_op * op)
        
        param = op->param;
        
+       env_list = NULL;
        r = imap_get_envelopes_list(param->imap, param->set,
                                    &env_list);
        
@@ -1761,6 +1790,23 @@ int imap_threaded_fetch_env(Folder * folder, struct mailimap_set * set,
        
        threaded_run(folder, &param, &result, fetch_env_run);
        
+       if (result.error != MAILIMAP_NO_ERROR) {
+               chashdatum key;
+               chashdatum value;
+               int r;
+               
+               key.data = &imap;
+               key.len = sizeof(imap);
+               r = chash_get(courier_workaround_hash, &key, &value);
+               if (r < 0) {
+                       value.data = NULL;
+                       value.len = 0;
+                       chash_set(courier_workaround_hash, &key, &value, NULL);
+                       
+                       threaded_run(folder, &param, &result, fetch_env_run);
+               }
+       }
+       
        if (result.error != MAILIMAP_NO_ERROR)
                return result.error;