const ModestLocalFolder ModestLocalFolderMap[] = {
{ TNY_FOLDER_TYPE_UNKNOWN, "<unknown>", N_("<Unknown>")},
{ TNY_FOLDER_TYPE_NORMAL, "<normal>", N_("<Normal>")},
- /* There is no special Inbox folder for local accounts */
-/* { TNY_FOLDER_TYPE_INBOX, "inbox", N_("mcen_me_folder_inbox")}, */
{ TNY_FOLDER_TYPE_OUTBOX, "outbox", N_("mcen_me_folder_outbox")},
{ TNY_FOLDER_TYPE_TRASH, "trash", N_("Trash")},
{ TNY_FOLDER_TYPE_JUNK, "junk", N_("Junk")},
{ TNY_FOLDER_TYPE_ROOT, "<root>", N_("<root>")},
{ TNY_FOLDER_TYPE_NOTES, "notes", N_("Notes")},
{ TNY_FOLDER_TYPE_DRAFTS, "drafts", N_("mcen_me_folder_drafts")},
-/* TODO: Do we want these? If so, they need a type ID:
- * { TNY_FOLDER_TYPE_OUTBOX, "contacts", N_("Contacts")},
- { TNY_FOLDER_TYPE_OUTBOX, "calendar", N_("Calendar")},
-*/
{ TNY_FOLDER_TYPE_ARCHIVE, "archive", N_("mcen_me_folder_archive")}
};
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 =
g_free (fname);
fname = g_strdup (modest_local_folder_info_get_type_display_name (type));
}
+ } else {
+ /* Sometimes an special folder is reported by the server as
+ NORMAL, like some versions of Dovecot */
+ if (type == TNY_FOLDER_TYPE_NORMAL ||
+ type == TNY_FOLDER_TYPE_UNKNOWN) {
+ type = modest_tny_folder_guess_folder_type (TNY_FOLDER (instance));
+ }
}
/* note: we cannot reliably get the counts from the tree model, we need
*ammc_pixbuf_close = NULL, *avirt_pixbuf_close = NULL;
- /* MERGE is not needed anymore as the folder now has the correct type jschmid */
- /* We include the MERGE type here because it's used to create
- the local OUTBOX folder */
+ /* Sometimes an special folder is reported by the server as
+ NORMAL, like some versions of Dovecot */
if (type == TNY_FOLDER_TYPE_NORMAL ||
type == TNY_FOLDER_TYPE_UNKNOWN) {
type = modest_tny_folder_guess_folder_type (TNY_FOLDER (instance));