diff options
Diffstat (limited to 'camel/providers')
-rw-r--r-- | camel/providers/imap/camel-imap-folder.c | 11 |
1 files changed, 8 insertions, 3 deletions
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)) { |