From 218b162a5dd404672af53d0763def1b037b10535 Mon Sep 17 00:00:00 2001 From: Not Zed Date: Mon, 28 Jun 2004 06:59:38 +0000 Subject: take url argument directly, fixes a memleak. (camel_folder_info_new): make 2004-06-28 Not Zed * 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 --- camel/ChangeLog | 8 ++++++++ camel/providers/local/camel-maildir-store.c | 29 ++++++++++++++++++++++------- 2 files changed, 30 insertions(+), 7 deletions(-) diff --git a/camel/ChangeLog b/camel/ChangeLog index ffa85aead9..9ea8900535 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,11 @@ +2004-06-28 Not Zed + + * 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. + 2004-06-27 Jeffrey Stedfast * camel-url-scanner.c (camel_url_web_end): More fixes. 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) -- cgit