X-Git-Url: http://git.maemo.org/git/?a=blobdiff_plain;f=src%2Fmodest-tny-folder.c;h=87f6921cf894876591e14786a83631af27cfa74c;hb=6011f47430718f4b1b0fe5fd74484b5153103f53;hp=915c7876212086886d9b63de7737d99b0d5a9433;hpb=60070e492a8b67dd8f245a676f9d6e7188684aa9;p=modest diff --git a/src/modest-tny-folder.c b/src/modest-tny-folder.c index 915c787..87f6921 100644 --- a/src/modest-tny-folder.c +++ b/src/modest-tny-folder.c @@ -31,11 +31,11 @@ #include #include #include +#include #include #include #include #include -#include #include #include #include @@ -69,6 +69,26 @@ modest_tny_folder_guess_folder_type (TnyFolder *folder) type = modest_tny_folder_get_local_or_mmc_folder_type (folder); else type = tny_folder_get_folder_type (TNY_FOLDER (folder)); + + /* Fallback code, some servers (Dovecot in some versions) + report incorrectly that the INBOX folder is a normal + folder. Really ugly code but... */ + if (type == TNY_FOLDER_TYPE_NORMAL) { + TnyFolderStore *parent = tny_folder_get_folder_store (folder); + if (parent) { + if (TNY_IS_ACCOUNT (parent)) { + gchar *downcase = + g_ascii_strdown (tny_camel_folder_get_full_name (TNY_CAMEL_FOLDER (folder)), + -1); + + if ((strlen (downcase) == 5) && + !strncmp (downcase, "inbox", 5)) + type = TNY_FOLDER_TYPE_INBOX; + g_free (downcase); + } + g_object_unref (parent); + } + } if (type == TNY_FOLDER_TYPE_UNKNOWN) { const gchar *folder_name = @@ -148,17 +168,20 @@ modest_tny_folder_get_rules (TnyFolder *folder) break; } } else { - ModestTransportStoreProtocol proto; + ModestProtocolRegistry *protocol_registry; + ModestProtocolType protocol_type; TnyFolderType folder_type; TnyAccount *account; + protocol_registry = modest_runtime_get_protocol_registry (); + account = modest_tny_folder_get_account ((TnyFolder*)folder); if (!account) return -1; /* no account: nothing is allowed */ - proto = modest_protocol_info_get_transport_store_protocol (tny_account_get_proto (account)); + protocol_type = modest_tny_account_get_protocol_type (account); - if (proto == MODEST_PROTOCOL_STORE_IMAP) { + if (modest_protocol_registry_protocol_type_has_tag (protocol_registry, protocol_type, MODEST_PROTOCOL_REGISTRY_STORE_HAS_FOLDERS)) { rules = 0; } else { /* pop, nntp, ... */ @@ -395,7 +418,7 @@ modest_tny_folder_has_subfolder_with_name (TnyFolderStore *parent, /* Get direct subfolders */ subfolders = tny_simple_list_new (); - tny_folder_store_get_folders (parent, subfolders, NULL, &err); + tny_folder_store_get_folders (parent, subfolders, NULL, FALSE, &err); /* Check names */ iter = tny_list_create_iterator (subfolders);