Fix modest_tny_msg_header_get_all_recipients_list (in case from is empty)
[modest] / src / modest-local-folder-info.c
index 60bf668..d0bcb75 100644 (file)
@@ -30,6 +30,7 @@
 #include <glib/gi18n.h>
 #include <string.h> /* strcmp */
 #include <modest-local-folder-info.h>
+#include <modest-defs.h>
 #include <stdio.h>
 
 typedef struct {
@@ -41,8 +42,6 @@ typedef struct {
 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")},
@@ -50,11 +49,7 @@ const ModestLocalFolder ModestLocalFolderMap[] = {
        { 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_("Archive")}
+       { TNY_FOLDER_TYPE_ARCHIVE,  "archive",    N_("mcen_me_folder_archive")}
 };
 
 
@@ -114,17 +109,30 @@ modest_local_folder_info_get_maildir_path (const gchar* location_filepath)
                                 NULL);
 }
 
-gchar *modest_per_account_local_outbox_folder_info_get_maildir_path (const gchar* account_name)
+gchar*
+modest_per_account_local_outbox_folder_info_get_maildir_path (const gchar* account_name)
 {
        /* This directory should contain an "outbox" child directory: */
-       return g_build_filename (g_get_home_dir(),
-                                MODEST_DIR,
-                                MODEST_PER_ACCOUNT_LOCAL_OUTBOX_FOLDERS_MAILDIR, 
-                                account_name,
-                                NULL);
+       gchar *escaped, *filename;
+
+#if GLIB_CHECK_VERSION(2, 16, 0)
+       escaped = g_uri_escape_string (account_name, NULL, FALSE);
+#else
+       /* TODO: escape without calling glib */
+       escaped = g_strdup (account_name);
+#endif
+       filename = g_build_filename (g_get_home_dir(),
+                                    MODEST_DIR,
+                                    MODEST_PER_ACCOUNT_LOCAL_OUTBOX_FOLDERS_MAILDIR, 
+                                    escaped,
+                                    NULL);
+       g_free (escaped);
+
+       return filename;
 }
 
-gchar *modest_per_account_local_outbox_folder_info_get_maildir_path_to_outbox_folder (const gchar* account_name)
+gchar*
+modest_per_account_local_outbox_folder_info_get_maildir_path_to_outbox_folder (const gchar* account_name)
 {
        gchar *path_to_account_folder = 
                modest_per_account_local_outbox_folder_info_get_maildir_path(account_name);