From 32e0e0d031ecb72834a564952027292109e17af6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ho=C3=A0=20Vi=C3=AAt=20Dinh?= Date: Sun, 10 Jul 2005 23:37:45 +0000 Subject: [PATCH] 2005-07-10 [hoa] 1.9.12cvs33 * src/etpan/imap-thread.c workaround for old Courier IMAP servers. --- ChangeLog-gtk2.claws | 5 +++++ PATCHSETS | 1 + configure.ac | 2 +- src/etpan/imap-thread.c | 48 ++++++++++++++++++++++++++++++++++++++++- 4 files changed, 54 insertions(+), 2 deletions(-) diff --git a/ChangeLog-gtk2.claws b/ChangeLog-gtk2.claws index 77fed234f..8fede2383 100644 --- a/ChangeLog-gtk2.claws +++ b/ChangeLog-gtk2.claws @@ -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 diff --git a/PATCHSETS b/PATCHSETS index 2356d47fd..4f2d47e2f 100644 --- a/PATCHSETS +++ b/PATCHSETS @@ -627,3 +627,4 @@ ( 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 diff --git a/configure.ac b/configure.ac index aba63fcf9..dc3ebb053 100644 --- a/configure.ac +++ b/configure.ac @@ -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= diff --git a/src/etpan/imap-thread.c b/src/etpan/imap-thread.c index 5b4928587..28d9aed19 100644 --- a/src/etpan/imap-thread.c +++ b/src/etpan/imap-thread.c @@ -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, ¶m, &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, ¶m, &result, fetch_env_run); + } + } + if (result.error != MAILIMAP_NO_ERROR) return result.error; -- 2.25.1