- const gchar* account_id = tny_account_get_id (account);
- const gboolean is_actual_local_folders_account = account_id &&
- (strcmp (account_id, MODEST_LOCAL_FOLDERS_ACCOUNT_ID) == 0);
-
- TnyList *list_outbox_folders = tny_simple_list_new ();
- tny_folder_store_get_folders (TNY_FOLDER_STORE (account),
- list_outbox_folders, NULL, NULL);
-
- TnyIterator* iter = tny_list_create_iterator (list_outbox_folders);
- while (!tny_iterator_is_done (iter))
- {
- TnyFolder *folder = TNY_FOLDER (tny_iterator_get_current (iter));
-
- if (folder) {
- gboolean add = TRUE;
- /* TODO: Do not add outboxes that are inside local-folders/,
- * because these are just left-over from earlier Modest versions
- * that put the outbox there: */
- if (is_actual_local_folders_account) {
- const TnyFolderType type = modest_tny_folder_get_local_folder_type (folder);
- if (type == TNY_FOLDER_TYPE_OUTBOX) {
- add = FALSE;
- }
+ ModestTnyLocalFoldersAccountPrivate *priv;
+ gchar *down_name;
+ const gchar *type_name;
+ gboolean retval;
+
+ /* Check that we're not trying to create/rename any folder
+ with the same name that our OUTBOX, DRAFT, SENT */
+ priv = TNY_LOCAL_FOLDERS_ACCOUNT_GET_PRIVATE (self);
+ down_name = g_utf8_strdown (name, strlen (name));
+
+ type_name = modest_local_folder_info_get_type_name (TNY_FOLDER_TYPE_OUTBOX);
+ if (!strcmp (type_name, down_name)) {
+ retval = TRUE;
+ } else {
+ type_name = modest_local_folder_info_get_type_name (TNY_FOLDER_TYPE_DRAFTS);
+ if (!strcmp (type_name, down_name)) {
+ retval = TRUE;
+ } else {
+ type_name = modest_local_folder_info_get_type_name (TNY_FOLDER_TYPE_SENT);
+ if (!strcmp (type_name, down_name)) {
+ retval = TRUE;
+ } else {
+ retval = FALSE;