diff options
author | Jeffrey Stedfast <fejj@helixcode.com> | 2000-06-23 10:31:47 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2000-06-23 10:31:47 +0800 |
commit | 642d8b228a1e2207b921dc22508e9ffed888b877 (patch) | |
tree | 55e3953592c4a62b0e09d9eff94d84a93ccd3ba3 | |
parent | 30f5127773cfacc67b83ead6d644db07fa817381 (diff) | |
download | gsoc2013-evolution-642d8b228a1e2207b921dc22508e9ffed888b877.tar gsoc2013-evolution-642d8b228a1e2207b921dc22508e9ffed888b877.tar.gz gsoc2013-evolution-642d8b228a1e2207b921dc22508e9ffed888b877.tar.bz2 gsoc2013-evolution-642d8b228a1e2207b921dc22508e9ffed888b877.tar.lz gsoc2013-evolution-642d8b228a1e2207b921dc22508e9ffed888b877.tar.xz gsoc2013-evolution-642d8b228a1e2207b921dc22508e9ffed888b877.tar.zst gsoc2013-evolution-642d8b228a1e2207b921dc22508e9ffed888b877.zip |
Oops. Now appends the namespace to the folder before querying for the
2000-06-22 Jeffrey Stedfast <fejj@helixcode.com>
* providers/imap/camel-imap-folder.c (imap_get_message_count):
Oops. Now appends the namespace to the folder before querying
for the number of messages.
* providers/imap/camel-imap-store.c (imap_folder_exists): New
convenience function for use by imap_create().
(get_folder): If folder is specified as "/", we really want
"INBOX".
* providers/sendmail/camel-sendmail-provider.c:
* providers/vee/camel-vee-provider.c:
* providers/smtp/camel-smtp-provider.c:
* providers/mbox/camel-mbox-provider.c:
* providers/pop3/camel-pop3-provider.c:
* providers/imap/camel-imap-provider.c: Updated
* camel-session.c: Moved service_cache hash table into the
providers.
(service_cache_remove): Updated.
(camel_session_get_service): Updated.
* camel-url.c (camel_url_hash): Took out the hashing of
url->passwd. We don't want this anymore.
* providers/imap/camel-imap-folder.c (imap_init): Took out
references to 'namespace'
(camel_imap_folder_init): Same
* providers/imap/camel-imap-folder.h: No more namespace. We are
instead going to use url->path as the namespace.
svn path=/trunk/; revision=3705
-rw-r--r-- | camel/ChangeLog | 9 | ||||
-rw-r--r-- | camel/providers/imap/camel-imap-folder.c | 51 | ||||
-rw-r--r-- | camel/providers/imap/camel-imap-store.c | 40 |
3 files changed, 48 insertions, 52 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog index b0b7c0a9e3..ea796dc1da 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,5 +1,14 @@ 2000-06-22 Jeffrey Stedfast <fejj@helixcode.com> + * providers/imap/camel-imap-folder.c (imap_get_message_count): + Oops. Now appends the namespace to the folder before querying + for the number of messages. + + * providers/imap/camel-imap-store.c (imap_folder_exists): New + convenience function for use by imap_create(). + (get_folder): If folder is specified as "/", we really want + "INBOX". + * providers/sendmail/camel-sendmail-provider.c: * providers/vee/camel-vee-provider.c: * providers/smtp/camel-smtp-provider.c: diff --git a/camel/providers/imap/camel-imap-folder.c b/camel/providers/imap/camel-imap-folder.c index 5b31517f24..6c38eb3cf5 100644 --- a/camel/providers/imap/camel-imap-folder.c +++ b/camel/providers/imap/camel-imap-folder.c @@ -186,7 +186,7 @@ camel_imap_folder_new (CamelStore *parent, char *folder_name, CamelException *ex { CamelFolder *folder = CAMEL_FOLDER (gtk_object_new (camel_imap_folder_get_type (), NULL)); - CF_CLASS (folder)->init (folder, parent, NULL, "INBOX", "/", FALSE, ex); + CF_CLASS (folder)->init (folder, parent, NULL, folder_name, "/", FALSE, ex); return folder; } @@ -383,49 +383,6 @@ imap_expunge (CamelFolder *folder, CamelException *ex) #if 0 static gboolean -imap_exists (CamelFolder *folder, CamelException *ex) -{ - /* make sure the folder exists */ - GPtrArray *lsub; - gboolean exists = FALSE; - int i, max; - - g_return_val_if_fail (folder != NULL, FALSE); - - /* check if the imap file path is determined */ - if (!folder->full_name) { - camel_exception_set (ex, CAMEL_EXCEPTION_FOLDER_INVALID, - "undetermined folder file path. Maybe use set_name ?"); - return FALSE; - } - - /* check if the imap dir path is determined */ - if (!folder->full_name) { - camel_exception_set (ex, CAMEL_EXCEPTION_FOLDER_INVALID, - "undetermined folder directory path. Maybe use set_name ?"); - return FALSE; - } - - /* Get a listing of the folders that exist */ - lsub = imap_get_subfolder_names (folder, ex); - - /* look to see if any of those subfolders match... */ - max = lsub->len; - for (i = 0; i < max; i++) { - if (!strcmp (g_ptr_array_index (lsub, i), folder->full_name)) { - exists = TRUE; - break; - } - } - - g_ptr_array_free (lsub, TRUE); - - return exists; -} -#endif - -#if 0 -static gboolean imap_delete (CamelFolder *folder, gboolean recurse, CamelException *ex) { /* TODO: code this & what should this do? delete messages or the folder? */ @@ -488,13 +445,13 @@ imap_get_message_count (CamelFolder *folder, CamelException *ex) folder_path = g_strdup (folder->full_name); status = camel_imap_command_extended (CAMEL_IMAP_STORE (folder->parent_store), folder, - &result, "STATUS %s (MESSAGES)", folder->full_name); + &result, "STATUS %s (MESSAGES)", folder_path); if (status != CAMEL_IMAP_OK) { CamelService *service = CAMEL_SERVICE (folder->parent_store); camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE, - "Could not get message count from IMAP " - "server %s: %s.", service->url->host, + "Could not get message count for %s from IMAP " + "server %s: %s.", folder_path, service->url->host, status == CAMEL_IMAP_ERR ? result : "Unknown error"); g_free (result); diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c index c3416533f4..863501487b 100644 --- a/camel/providers/imap/camel-imap-store.c +++ b/camel/providers/imap/camel-imap-store.c @@ -318,6 +318,33 @@ camel_imap_store_get_toplevel_dir (CamelImapStore *store) } static gboolean +imap_folder_exists (CamelFolder *folder) +{ + CamelStore *store = CAMEL_STORE (folder->parent_store); + CamelURL *url = CAMEL_SERVICE (store)->url; + gchar *result, *folder_path; + gint status; + + if (url && url->path && strcmp (folder->full_name, "INBOX")) + folder_path = g_strdup_printf ("%s/%s", url->path + 1, folder->full_name); + else + folder_path = g_strdup (folder->full_name); + + status = camel_imap_command_extended (CAMEL_IMAP_STORE (folder->parent_store), NULL, + &result, "EXAMINE %s", folder_path); + + if (status != CAMEL_IMAP_OK) { + g_free (result); + g_free (folder_path); + return FALSE; + } + g_free (folder_path); + g_free (result); + + return TRUE; +} + +static gboolean imap_create (CamelFolder *folder, CamelException *ex) { CamelStore *store = CAMEL_STORE (folder->parent_store); @@ -335,8 +362,8 @@ imap_create (CamelFolder *folder, CamelException *ex) if (!strcmp (folder->full_name, "INBOX")) return TRUE; - - if (camel_folder_get_subfolder (folder->parent_folder, folder->name, FALSE, ex)) + + if (imap_folder_exists (folder)) return TRUE; /* create the directory for the subfolder */ @@ -374,11 +401,14 @@ get_folder (CamelStore *store, const char *folder_name, gboolean create, CamelEx g_return_val_if_fail (store != NULL, NULL); g_return_val_if_fail (folder_name != NULL, NULL); - folder_path = g_strdup (folder_name); + if (!strcmp (folder_name, "/")) + folder_path = g_strdup ("INBOX"); + else + folder_path = g_strdup (folder_name); + new_folder = camel_imap_folder_new (store, folder_path, ex); - if (!imap_create (new_folder, ex)) { - /* we should set an exception */ + if (create && !imap_create (new_folder, ex)) { return NULL; } |