aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2004-06-28 14:59:38 +0800
committerMichael Zucci <zucchi@src.gnome.org>2004-06-28 14:59:38 +0800
commit218b162a5dd404672af53d0763def1b037b10535 (patch)
tree1f9a78a76fe6ef47cb3d5545029ae9e731e8c994 /camel/providers
parent90d63d2b2a612734925dd632ff3bea063d80827f (diff)
downloadgsoc2013-evolution-218b162a5dd404672af53d0763def1b037b10535.tar.gz
gsoc2013-evolution-218b162a5dd404672af53d0763def1b037b10535.tar.zst
gsoc2013-evolution-218b162a5dd404672af53d0763def1b037b10535.zip
take url argument directly, fixes a memleak. (camel_folder_info_new): make
2004-06-28 Not Zed <NotZed@Ximian.com> * providers/local/camel-maildir-store.c (camel_folder_info_new): take url argument directly, fixes a memleak. (camel_folder_info_new): make the toplevel "." into "Inbox" always. (maildir_rename_folder): dont let users rename inbox. svn path=/trunk/; revision=26537
Diffstat (limited to 'camel/providers')
-rw-r--r--camel/providers/local/camel-maildir-store.c29
1 files changed, 22 insertions, 7 deletions
diff --git a/camel/providers/local/camel-maildir-store.c b/camel/providers/local/camel-maildir-store.c
index 92375b99bc..853c02ccac 100644
--- a/camel/providers/local/camel-maildir-store.c
+++ b/camel/providers/local/camel-maildir-store.c
@@ -222,20 +222,35 @@ static void delete_folder(CamelStore * store, const char *folder_name, CamelExce
g_free(new);
}
-static CamelFolderInfo *camel_folder_info_new(const char *url, const char *full, const char *name)
+static void
+maildir_rename_folder(CamelStore *store, const char *old, const char *new, CamelException *ex)
+{
+ CamelFolder *folder;
+
+ if (strcmp(old, ".") == 0) {
+ camel_exception_setv(ex, CAMEL_EXCEPTION_STORE_NO_FOLDER,
+ _("Cannot rename folder: %s: Invalid operation"), _("Inbox"));
+ return;
+ }
+
+ ((CamelStoreClass *)parent_class)->rename_folder(store, old, new, ex);
+}
+
+static CamelFolderInfo *camel_folder_info_new(CamelURL *url, const char *full, const char *name)
{
CamelFolderInfo *fi;
fi = g_malloc0(sizeof(*fi));
- fi->uri = g_strdup(url);
+ fi->uri = camel_url_to_string(url, 0);
fi->full_name = g_strdup(full);
- fi->name = g_strdup(name);
+ if (!strcmp(full, ".")) {
+ fi->flags |= CAMEL_FOLDER_SYSTEM;
+ fi->name = g_strdup(_("Inbox"));
+ } else
+ fi->name = g_strdup(name);
fi->unread = -1;
fi->total = -1;
- if (!strcmp(full, "."))
- fi->flags |= CAMEL_FOLDER_SYSTEM;
-
d(printf("Adding maildir info: '%s' '%s' '%s' '%s'\n", fi->path, fi->name, fi->full_name, fi->url));
return fi;
@@ -311,7 +326,7 @@ static int scan_dir(CamelStore *store, GHashTable *visited, CamelURL *url, const
camel_url_set_fragment(url, path);
- fi = camel_folder_info_new(camel_url_to_string(url, 0), path, base);
+ fi = camel_folder_info_new(url, path, base);
fill_fi(store, fi, flags);
if (!(stat(tmp, &st) == 0 && S_ISDIR(st.st_mode)