diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2002-08-23 03:28:22 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2002-08-23 03:28:22 +0800 |
commit | d05a75a2b84c23d1f94233c14a632898663f28d1 (patch) | |
tree | 54d330f41658a5b0dcf6fca734c3059876732f22 | |
parent | 34208006ae99718571b35055cec8d8e2718df1dc (diff) | |
download | gsoc2013-evolution-d05a75a2b84c23d1f94233c14a632898663f28d1.tar gsoc2013-evolution-d05a75a2b84c23d1f94233c14a632898663f28d1.tar.gz gsoc2013-evolution-d05a75a2b84c23d1f94233c14a632898663f28d1.tar.bz2 gsoc2013-evolution-d05a75a2b84c23d1f94233c14a632898663f28d1.tar.lz gsoc2013-evolution-d05a75a2b84c23d1f94233c14a632898663f28d1.tar.xz gsoc2013-evolution-d05a75a2b84c23d1f94233c14a632898663f28d1.tar.zst gsoc2013-evolution-d05a75a2b84c23d1f94233c14a632898663f28d1.zip |
Workaround for Courier imap's brokeness when LSUBing the INBOX folder when
2002-08-22 Jeffrey Stedfast <fejj@ximian.com>
* providers/imap/camel-imap-utils.c (imap_parse_list_response):
Workaround for Courier imap's brokeness when LSUBing the INBOX
folder when it isn't subscribed to. Fixes bug #28929.
svn path=/trunk/; revision=17841
-rw-r--r-- | camel/ChangeLog | 12 | ||||
-rw-r--r-- | camel/providers/imap/camel-imap-store.c | 22 | ||||
-rw-r--r-- | camel/providers/imap/camel-imap-utils.c | 20 |
3 files changed, 43 insertions, 11 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog index 6599dfbdba..224b3e2dc6 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,15 @@ +2002-08-22 Jeffrey Stedfast <fejj@ximian.com> + + * providers/imap/camel-imap-utils.c (imap_parse_list_response): + Workaround for Courier imap's brokeness when LSUBing the INBOX + folder when it isn't subscribed to. Fixes bug #28929. + +2002-08-21 Jeffrey Stedfast <fejj@ximian.com> + + * providers/imap/camel-imap-store.c (connect_to_server): If + imap_get_capability() fails, after unlocking the command_lock, + disconnect the service. + 2002-08-21 Jeffrey Stedfast <fejj@ximian.com> * camel-session.c (get_service): Don't register the noop timeout diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c index 9950849539..d269df71a5 100644 --- a/camel/providers/imap/camel-imap-store.c +++ b/camel/providers/imap/camel-imap-store.c @@ -1770,7 +1770,7 @@ create_folder (CamelStore *store, const char *parent_name, return NULL; if (!parent_name) parent_name = ""; - + if (strchr (folder_name, imap_store->dir_sep)) { camel_exception_setv (ex, CAMEL_EXCEPTION_FOLDER_INVALID_PATH, _("The folder name \"%s\" is invalid because " @@ -1778,7 +1778,7 @@ create_folder (CamelStore *store, const char *parent_name, folder_name, imap_store->dir_sep); return NULL; } - + /* check if the parent allows inferiors */ need_convert = FALSE; @@ -1961,29 +1961,29 @@ copy_folder_name (gpointer name, gpointer key, gpointer array) /* this is used when lsub doesn't provide very useful information */ static GPtrArray * -get_subscribed_folders(CamelImapStore *imap_store, const char *top, CamelException *ex) +get_subscribed_folders (CamelImapStore *imap_store, const char *top, CamelException *ex) { GPtrArray *names, *folders; CamelImapResponse *response; CamelFolderInfo *fi; char *result; int i, toplen = strlen (top); - - folders = g_ptr_array_new(); + + folders = g_ptr_array_new (); names = g_ptr_array_new (); g_hash_table_foreach (imap_store->subscribed_folders, copy_folder_name, names); - + if (names->len == 0) - g_ptr_array_add(names, "INBOX"); - + g_ptr_array_add (names, "INBOX"); + for (i = 0; i < names->len; i++) { response = camel_imap_command (imap_store, NULL, ex, "LIST \"\" %F", names->pdata[i]); if (!response) break; - + result = camel_imap_response_extract (imap_store, response, "LIST", NULL); if (!result) { g_hash_table_remove (imap_store->subscribed_folders, @@ -2004,9 +2004,9 @@ get_subscribed_folders(CamelImapStore *imap_store, const char *top, CamelExcepti g_ptr_array_add (folders, fi); } - + g_ptr_array_free (names, TRUE); - + return folders; } diff --git a/camel/providers/imap/camel-imap-utils.c b/camel/providers/imap/camel-imap-utils.c index 4370d890ba..e07d1ccac3 100644 --- a/camel/providers/imap/camel-imap-utils.c +++ b/camel/providers/imap/camel-imap-utils.c @@ -292,6 +292,7 @@ imap_parse_namespace_response (const char *response) gboolean imap_parse_list_response (CamelImapStore *store, const char *buf, int *flags, char *sep, char **folder) { + gboolean is_lsub = FALSE; const char *word; size_t len; @@ -302,6 +303,10 @@ imap_parse_list_response (CamelImapStore *store, const char *buf, int *flags, ch if (g_strncasecmp (word, "LIST", 4) && g_strncasecmp (word, "LSUB", 4)) return FALSE; + /* check if we are looking at an LSUB response */ + if (word[1] == 'S' || word[1] == 's') + is_lsub = TRUE; + /* get the flags */ word = imap_next_word (word); if (*word != '(') @@ -363,6 +368,21 @@ imap_parse_list_response (CamelImapStore *store, const char *buf, int *flags, ch if (!mailbox) return FALSE; + /* Kludge around Courier imap's LSUB response for INBOX when it + * isn't subscribed to. + * + * Ignore any \Noselect flags for INBOX when parsing + * an LSUB response to work around the following response: + * + * * LSUB (\Noselect \HasChildren) "." "INBOX" + * + * Fixes bug #28929 (albeight in a very dodgy way imho, but what + * can ya do when ya got the ignorance of marketing breathing + * down your neck?) + */ + if (is_lsub && !strcasecmp (mailbox, "INBOX")) + *flags &= ~CAMEL_FOLDER_NOSELECT; + *folder = mailbox; } |