aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--camel/ChangeLog6
-rw-r--r--camel/providers/imap/camel-imap-folder.c11
2 files changed, 14 insertions, 3 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index 175d6f392d..40f649d5e0 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,9 @@
+2004-05-12 Jeffrey Stedfast <fejj@novell.com>
+
+ * providers/imap/camel-imap-folder.c (camel_imap_folder_selected):
+ Ignore PERMANENTFLAGS if it gives us an empty set. Works around
+ broken IMAP servers like the one in bug #58355.
+
2004-05-12 Not Zed <NotZed@Ximian.com>
* camel-folder-search.c (search_threads): changed to match_threads.
diff --git a/camel/providers/imap/camel-imap-folder.c b/camel/providers/imap/camel-imap-folder.c
index 7915441047..ce485e5495 100644
--- a/camel/providers/imap/camel-imap-folder.c
+++ b/camel/providers/imap/camel-imap-folder.c
@@ -283,7 +283,9 @@ camel_imap_folder_selected (CamelFolder *folder, CamelImapResponse *response,
CamelImapFolder *imap_folder = CAMEL_IMAP_FOLDER (folder);
CamelImapSummary *imap_summary = CAMEL_IMAP_SUMMARY (folder->summary);
unsigned long exists = 0, validity = 0, val, uid;
+ gboolean got_perm_flags = FALSE;
CamelMessageInfo *info;
+ guint32 perm_flags;
GData *fetch_data;
int i, count;
char *resp;
@@ -294,13 +296,16 @@ camel_imap_folder_selected (CamelFolder *folder, CamelImapResponse *response,
for (i = 0; i < response->untagged->len; i++) {
resp = response->untagged->pdata[i] + 2;
- if (!strncasecmp (resp, "FLAGS ", 6) &&
- !folder->permanent_flags) {
+ if (!strncasecmp (resp, "FLAGS ", 6) && !got_perm_flags) {
resp += 6;
folder->permanent_flags = imap_parse_flag_list (&resp);
} else if (!strncasecmp (resp, "OK [PERMANENTFLAGS ", 19)) {
resp += 19;
- folder->permanent_flags = imap_parse_flag_list (&resp);
+
+ /* workaround for broken IMAP servers that send "* OK [PERMANENTFLAGS ()] Permanent flags"
+ * even tho they do allow storing flags. *Sigh* So many fucking broken IMAP servers out there. */
+ if ((perm_flags = imap_parse_flag_list (&resp)) != 0)
+ folder->permanent_flags = perm_flags;
} else if (!strncasecmp (resp, "OK [UIDVALIDITY ", 16)) {
validity = strtoul (resp + 16, NULL, 10);
} else if (isdigit ((unsigned char)*resp)) {