diff options
author | 0 <NotZed@Ximian.com> | 2001-09-21 06:58:23 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2001-09-21 06:58:23 +0800 |
commit | a6aba35df1c77772c1417354a68a310f90944ced (patch) | |
tree | 861e43b059646000b3f087648ca2630438a39fcd /camel | |
parent | c503814d7ff5b5656cf1ac92c3f51a327859f76f (diff) | |
download | gsoc2013-evolution-a6aba35df1c77772c1417354a68a310f90944ced.tar.gz gsoc2013-evolution-a6aba35df1c77772c1417354a68a310f90944ced.tar.zst gsoc2013-evolution-a6aba35df1c77772c1417354a68a310f90944ced.zip |
Build the path on the folderinfo.
2001-09-20 <NotZed@Ximian.com>
* providers/local/camel-maildir-store.c (camel_folder_info_new):
Build the path on the folderinfo.
* providers/local/camel-spool-store.c (get_folder_info): If we
have this folder open, then set unread from the folder itself.
(get_folder_info): Change the INBOX path to not include the
leading /.
* providers/local/camel-spool-folder.c
(camel_spool_folder_construct): Fix path.
(camel_spool_folder_construct): Properly setup the url field when
we say we've got a new folder created.
* providers/imap/camel-imap-store.c (unsubscribe_folder): Build
path on folderinfo.
* camel-store.c (camel_folder_info_build_path): Prepend / to path.
* camel-vee-folder.c (camel_vee_folder_construct): Use macro for
unmatched folder name.
(camel_vee_folder_new): "
* camel-vee-store.c (vee_get_folder_info): Use macro for unmatched
folder name.
(vee_delete_folder): "
(vee_rename_folder): "
(vee_get_folder): Prepend / onto path.
(vee_delete_folder): Setup path in folderinfo.
(vee_get_folder_info): Fix path in folderinfo.
* camel-vee-folder.h (CAMEL_UNMATCHED_NAME): New define for
unmatched (internal) name.
svn path=/trunk/; revision=13022
Diffstat (limited to 'camel')
-rw-r--r-- | camel/ChangeLog | 35 | ||||
-rw-r--r-- | camel/camel-store.c | 2 | ||||
-rw-r--r-- | camel/camel-vee-folder.c | 6 | ||||
-rw-r--r-- | camel/camel-vee-folder.h | 2 | ||||
-rw-r--r-- | camel/camel-vee-store.c | 17 | ||||
-rw-r--r-- | camel/providers/imap/camel-imap-store.c | 4 | ||||
-rw-r--r-- | camel/providers/local/camel-local-folder.c | 9 | ||||
-rw-r--r-- | camel/providers/local/camel-local-store.c | 3 | ||||
-rw-r--r-- | camel/providers/local/camel-maildir-store.c | 1 | ||||
-rw-r--r-- | camel/providers/local/camel-spool-folder.c | 4 | ||||
-rw-r--r-- | camel/providers/local/camel-spool-store.c | 17 |
11 files changed, 73 insertions, 27 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog index f826c94d4e..482549acdc 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,38 @@ +2001-09-20 <NotZed@Ximian.com> + + * providers/local/camel-maildir-store.c (camel_folder_info_new): + Build the path on the folderinfo. + + * providers/local/camel-spool-store.c (get_folder_info): If we + have this folder open, then set unread from the folder itself. + (get_folder_info): Change the INBOX path to not include the + leading /. + + * providers/local/camel-spool-folder.c + (camel_spool_folder_construct): Fix path. + (camel_spool_folder_construct): Properly setup the url field when + we say we've got a new folder created. + + * providers/imap/camel-imap-store.c (unsubscribe_folder): Build + path on folderinfo. + + * camel-store.c (camel_folder_info_build_path): Prepend / to path. + + * camel-vee-folder.c (camel_vee_folder_construct): Use macro for + unmatched folder name. + (camel_vee_folder_new): " + + * camel-vee-store.c (vee_get_folder_info): Use macro for unmatched + folder name. + (vee_delete_folder): " + (vee_rename_folder): " + (vee_get_folder): Prepend / onto path. + (vee_delete_folder): Setup path in folderinfo. + (vee_get_folder_info): Fix path in folderinfo. + + * camel-vee-folder.h (CAMEL_UNMATCHED_NAME): New define for + unmatched (internal) name. + 2001-09-20 Jeffrey Stedfast <fejj@ximian.com> * providers/local/camel-spool-folder.c diff --git a/camel/camel-store.c b/camel/camel-store.c index adef02a0b3..939b99bb4d 100644 --- a/camel/camel-store.c +++ b/camel/camel-store.c @@ -684,7 +684,7 @@ camel_folder_info_free (CamelFolderInfo *fi) void camel_folder_info_build_path (CamelFolderInfo *fi, char separator) { - fi->path = g_strdup (fi->full_name); + fi->path = g_strdup_printf("/%s", fi->full_name); if (separator != '/') { char *p; diff --git a/camel/camel-vee-folder.c b/camel/camel-vee-folder.c index 31c50a52ae..59bbcfcbf2 100644 --- a/camel/camel-vee-folder.c +++ b/camel/camel-vee-folder.c @@ -217,7 +217,7 @@ camel_vee_folder_construct(CamelVeeFolder *vf, CamelStore *parent_store, const c folder_unmatched = (CamelVeeFolder *)camel_object_new (camel_vee_folder_get_type ()); d(printf("created foldeer unmatched %p\n", folder_unmatched)); - vee_folder_construct (folder_unmatched, parent_store, "UNMATCHED", CAMEL_STORE_FOLDER_PRIVATE); + vee_folder_construct (folder_unmatched, parent_store, CAMEL_UNMATCHED_NAME, CAMEL_STORE_FOLDER_PRIVATE); } UNMATCHED_UNLOCK(); @@ -247,12 +247,12 @@ camel_vee_folder_new(CamelStore *parent_store, const char *name, guint32 flags) unmatched_uids = g_hash_table_new(g_str_hash, g_str_equal); folder_unmatched = vf = (CamelVeeFolder *)camel_object_new(camel_vee_folder_get_type()); d(printf("created foldeer unmatched %p\n", folder_unmatched)); - vee_folder_construct (vf, parent_store, "UNMATCHED", CAMEL_STORE_FOLDER_PRIVATE); + vee_folder_construct (vf, parent_store, CAMEL_UNMATCHED_NAME, CAMEL_STORE_FOLDER_PRIVATE); } UNMATCHED_UNLOCK(); - if (strcmp(name, "UNMATCHED") == 0) { + if (strcmp(name, CAMEL_UNMATCHED_NAME) == 0) { camel_object_ref((CamelObject *)folder_unmatched); d(printf("returning unmatched %p, count = %d\n", folder_unmatched, camel_folder_get_message_count((CamelFolder *)folder_unmatched))); return (CamelFolder *)folder_unmatched; diff --git a/camel/camel-vee-folder.h b/camel/camel-vee-folder.h index 83705751c7..a2295ba7d8 100644 --- a/camel/camel-vee-folder.h +++ b/camel/camel-vee-folder.h @@ -56,6 +56,8 @@ struct _CamelVeeFolderClass { CamelFolderClass parent_class; }; +#define CAMEL_UNMATCHED_NAME "UNMATCHED" + guint camel_vee_folder_get_type (void); CamelFolder *camel_vee_folder_new (CamelStore *parent_store, const char *name, guint32 flags); void camel_vee_folder_construct (CamelVeeFolder *vf, CamelStore *parent_store, const char *name, guint32 flags); diff --git a/camel/camel-vee-store.c b/camel/camel-vee-store.c index 48465fc87a..dc3febc85d 100644 --- a/camel/camel-vee-store.c +++ b/camel/camel-vee-store.c @@ -135,7 +135,7 @@ vee_get_folder (CamelStore *store, const char *folder_name, guint32 flags, Camel fi->url = g_strdup_printf("vfolder:%s#%s", ((CamelService *)store)->url->path, ((CamelFolder *)vf)->full_name); fi->unread_message_count = camel_folder_get_message_count((CamelFolder *)vf); - fi->path = g_strdup (fi->full_name); + camel_folder_info_build_path(fi, '/'); camel_object_trigger_event(CAMEL_OBJECT(store), "folder_created", fi); camel_folder_info_free(fi); } @@ -207,13 +207,13 @@ vee_get_folder_info(CamelStore *store, const char *top, guint32 flags, CamelExce CAMEL_STORE_UNLOCK(store, cache_lock); /* and always add UNMATCHED, if scanning from top/etc */ - if (top == NULL || top[0] == 0 || strncmp(top, "UNMATCHED", strlen("UNMATCHED")) == 0) { + if (top == NULL || top[0] == 0 || strncmp(top, CAMEL_UNMATCHED_NAME, strlen(CAMEL_UNMATCHED_NAME)) == 0) { info = g_malloc0(sizeof(*info)); - info->url = g_strdup_printf("vfolder:%s#UNMATCHED", ((CamelService *)store)->url->path); - info->full_name = g_strdup("UNMATCHED"); - info->name = g_strdup("UNMATCHED"); + info->url = g_strdup_printf("vfolder:%s#%s", ((CamelService *)store)->url->path, CAMEL_UNMATCHED_NAME); + info->full_name = g_strdup(CAMEL_UNMATCHED_NAME); + info->name = g_strdup(CAMEL_UNMATCHED_NAME); info->unread_message_count = -1; - info->path = g_strdup (info->full_name); + camel_folder_info_build_path(info, '/'); g_ptr_array_add(data.infos, info); } @@ -230,7 +230,7 @@ vee_delete_folder(CamelStore *store, const char *folder_name, CamelException *ex CamelFolder *folder; char *key; - if (strcmp(folder_name, "UNMATCHED") == 0) { + if (strcmp(folder_name, CAMEL_UNMATCHED_NAME) == 0) { camel_exception_setv(ex, CAMEL_EXCEPTION_STORE_NO_FOLDER, _("Cannot delete folder: %s: Invalid operation"), folder_name); return; @@ -258,6 +258,7 @@ vee_delete_folder(CamelStore *store, const char *folder_name, CamelException *ex fi->name = g_strdup(fi->name); fi->url = g_strdup_printf("vfolder:%s#%s", ((CamelService *)store)->url->path, key); fi->unread_message_count = -1; + camel_folder_info_build_path(fi, '/'); camel_object_trigger_event(CAMEL_OBJECT(store), "folder_deleted", fi); camel_folder_info_free(fi); @@ -277,7 +278,7 @@ vee_rename_folder(CamelStore *store, const char *old, const char *new, CamelExce CamelFolder *folder; char *key, *oldname, *full_oldname; - if (strcmp(old, "UNMATCHED") == 0) { + if (strcmp(old, CAMEL_UNMATCHED_NAME) == 0) { camel_exception_setv(ex, CAMEL_EXCEPTION_STORE_NO_FOLDER, _("Cannot rename folder: %s: Invalid operation"), old); return; diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c index 08c871cee3..a632c6f0d6 100644 --- a/camel/providers/imap/camel-imap-store.c +++ b/camel/providers/imap/camel-imap-store.c @@ -1542,14 +1542,11 @@ subscribe_folder (CamelStore *store, const char *folder_name, if (name) name++; - /* FIXME: we should probably relocate all code that generates - fi->path to a single location and have all code use that */ fi = g_new0 (CamelFolderInfo, 1); fi->full_name = g_strdup (folder_name); fi->name = g_strdup (name); fi->url = g_strdup_printf ("%s/%s", imap_store->base_url, folder_name); fi->unread_message_count = -1; - camel_folder_info_build_path (fi, imap_store->dir_sep); camel_object_trigger_event (CAMEL_OBJECT (store), "folder_created", fi); @@ -1591,6 +1588,7 @@ unsubscribe_folder (CamelStore *store, const char *folder_name, fi->name = g_strdup (name); fi->url = g_strdup_printf ("%s/%s", imap_store->base_url, folder_name); fi->unread_message_count = -1; + camel_folder_info_build_path (fi, imap_store->dir_sep); camel_object_trigger_event (CAMEL_OBJECT (store), "folder_deleted", fi); camel_folder_info_free (fi); diff --git a/camel/providers/local/camel-local-folder.c b/camel/providers/local/camel-local-folder.c index bce610bc70..2887fcce73 100644 --- a/camel/providers/local/camel-local-folder.c +++ b/camel/providers/local/camel-local-folder.c @@ -226,12 +226,9 @@ camel_local_folder_construct(CamelLocalFolder *lf, CamelStore *parent_store, con fi->name = g_strdup (name); fi->url = g_strdup (lf->folder_path); fi->unread_message_count = -1; - fi->path = g_strdup (full_name); - - camel_object_trigger_event (CAMEL_OBJECT (parent_store), - "folder_created", fi); - - camel_folder_info_free (fi); + camel_folder_info_build_path(fi, '/'); + camel_object_trigger_event(CAMEL_OBJECT (parent_store), "folder_created", fi); + camel_folder_info_free(fi); return lf; } diff --git a/camel/providers/local/camel-local-store.c b/camel/providers/local/camel-local-store.c index 20f90ce315..92e5159f1b 100644 --- a/camel/providers/local/camel-local-store.c +++ b/camel/providers/local/camel-local-store.c @@ -303,7 +303,8 @@ delete_folder(CamelStore *store, const char *folder_name, CamelException *ex) fi->name = g_strdup (g_basename (folder_name)); fi->url = g_strdup_printf ("%s%s", CAMEL_SERVICE(store)->url->path, folder_name); fi->unread_message_count = -1; - + camel_folder_info_build_path(fi, '/'); + camel_object_trigger_event (CAMEL_OBJECT (store), "folder_deleted", fi); diff --git a/camel/providers/local/camel-maildir-store.c b/camel/providers/local/camel-maildir-store.c index 09188ad863..974a66a038 100644 --- a/camel/providers/local/camel-maildir-store.c +++ b/camel/providers/local/camel-maildir-store.c @@ -224,6 +224,7 @@ static CamelFolderInfo *camel_folder_info_new(const char *url, const char *full, fi->full_name = g_strdup(full); fi->name = g_strdup(name); fi->unread_message_count = unread; + camel_folder_info_build_path(fi, '/'); return fi; } diff --git a/camel/providers/local/camel-spool-folder.c b/camel/providers/local/camel-spool-folder.c index 43b8abec60..8e8b3758a5 100644 --- a/camel/providers/local/camel-spool-folder.c +++ b/camel/providers/local/camel-spool-folder.c @@ -206,9 +206,9 @@ camel_spool_folder_construct(CamelSpoolFolder *lf, CamelStore *parent_store, con fi = g_malloc0(sizeof(*fi)); fi->full_name = g_strdup(full_name); fi->name = g_strdup(name); - fi->url = g_strdup(lf->folder_path); + fi->url = g_strdup_printf("spool:%s#%s", ((CamelService *)parent_store)->url->path, fi->name); fi->unread_message_count = camel_folder_get_unread_message_count(folder); - fi->path = g_strdup (full_name); + camel_folder_info_build_path(fi, '/'); camel_object_trigger_event(CAMEL_OBJECT(parent_store), "folder_created", fi); camel_folder_info_free (fi); diff --git a/camel/providers/local/camel-spool-store.c b/camel/providers/local/camel-spool-store.c index 998c97597c..c10c0f252d 100644 --- a/camel/providers/local/camel-spool-store.c +++ b/camel/providers/local/camel-spool-store.c @@ -34,6 +34,7 @@ #include "camel-spool-folder.h" #include "camel-exception.h" #include "camel-url.h" +#include "camel-private.h" #define d(x) @@ -186,14 +187,24 @@ get_folder_info (CamelStore *store, const char *top, { CamelFolderInfo *fi = NULL; CamelService *service = (CamelService *)store; + CamelFolder *folder; - if (top == NULL || strcmp(top, "/INBOX") == 0) { + if (top == NULL || strcmp(top, "INBOX") == 0) { /* FIXME: if the folder is opened we could look it up? */ fi = g_malloc0(sizeof(*fi)); - fi->full_name = "/INBOX"; + fi->full_name = "INBOX"; fi->name = "INBOX"; fi->url = g_strdup_printf("spool:%s#%s", service->url->path, fi->name); - fi->unread_message_count = -1; + + CAMEL_STORE_LOCK(store, cache_lock); + folder = g_hash_table_lookup(store->folders, fi->full_name); + if (folder) + fi->unread_message_count = camel_folder_get_message_count(folder); + else + fi->unread_message_count = -1; + CAMEL_STORE_UNLOCK(store, cache_lock); + + camel_folder_info_build_path(fi, '/'); } return fi; |