From f789abbd422604206c386199c80fb5eac8e34733 Mon Sep 17 00:00:00 2001 From: Peter Williams Date: Mon, 6 Aug 2001 19:00:32 +0000 Subject: Completely hide the namespace from everything external to the IMAP code, 2001-08-06 Peter Williams Completely hide the namespace from everything external to the IMAP code, which Dan W says is the way it should be. * providers/imap/camel-imap-command.c (imap_command_strdup_vprintf): Add a new %F argument, which is like %S but will add the namespace (for folder names). (camel_imap_command): Use %F here. * providers/imap/camel-imap-utils.c (imap_parse_list_response): Changed to strip out the namespec when returning *folder. In order to do this we need to be passed the CamelImapStore. (imap_concat): Move to here from camel-imap-store.c, un-static (imap_namespace_concat): New function, adds the namespace to the folder name, unless it's INBOX. * providers/imap/camel-imap-utils.h: Prototypes. * providers/imap/camel-imap-store.c (imap_connect_online): Extra arg to imap_parse_list_response. (imap_connect_offline): Here too. (get_folder_status): Use %F. (get_folder_online): Here too. (delete_folder): Here too. (create_folder): Here too, and arg to imap_parse_list_response. (parse_list_response_as_folder_info): Arg to i_p_l_r. (get_subscribed_folders_by_hand): Use %F. (get_folders_online): Here too. (get_folder_info_online): Instead of checking for NULL @name, check for name = NULL or "", and set to "" instead of namespace. Pass "" instead of namespace to camel_folder_info_build. (subscribe_folder): Use %F. (unsubscribe_folder): Here too. * providers/imap/camel-imap-folder.c (imap_get_full_name): This now just returns folder->full_name. (do_append): Use %F (do_copy): Here too. svn path=/trunk/; revision=11705 --- camel/providers/imap/camel-imap-folder.c | 25 ++----------------------- 1 file changed, 2 insertions(+), 23 deletions(-) (limited to 'camel/providers/imap/camel-imap-folder.c') diff --git a/camel/providers/imap/camel-imap-folder.c b/camel/providers/imap/camel-imap-folder.c index ba30ac7cc1..054fd7c6a0 100644 --- a/camel/providers/imap/camel-imap-folder.c +++ b/camel/providers/imap/camel-imap-folder.c @@ -72,7 +72,6 @@ static void imap_rescan (CamelFolder *folder, int exists, CamelException *ex); static void imap_refresh_info (CamelFolder *folder, CamelException *ex); static void imap_sync_online (CamelFolder *folder, CamelException *ex); static void imap_sync_offline (CamelFolder *folder, CamelException *ex); -static const char *imap_get_full_name (CamelFolder *folder); static void imap_expunge_uids_online (CamelFolder *folder, GPtrArray *uids, CamelException *ex); static void imap_expunge_uids_offline (CamelFolder *folder, GPtrArray *uids, CamelException *ex); static void imap_expunge_uids_resyncing (CamelFolder *folder, GPtrArray *uids, CamelException *ex); @@ -114,7 +113,6 @@ camel_imap_folder_class_init (CamelImapFolderClass *camel_imap_folder_class) disco_folder_class = CAMEL_DISCO_FOLDER_CLASS (camel_type_get_global_classfuncs (camel_disco_folder_get_type ())); /* virtual method overload */ - camel_folder_class->get_full_name = imap_get_full_name; camel_folder_class->get_message = imap_get_message; camel_folder_class->move_messages_to = imap_move_messages_to; camel_folder_class->search_by_expression = imap_search_by_expression; @@ -859,25 +857,6 @@ imap_expunge_uids_resyncing (CamelFolder *folder, GPtrArray *uids, CamelExceptio CAMEL_IMAP_STORE_UNLOCK (store, command_lock); } -static const char * -imap_get_full_name (CamelFolder *folder) -{ - CamelImapStore *store = CAMEL_IMAP_STORE (folder->parent_store); - char *name; - int len; - - name = folder->full_name; - if (store->namespace && *store->namespace) { - len = strlen (store->namespace); - if (!strncmp (store->namespace, folder->full_name, len) && - strlen (folder->full_name) > len) - name += len; - if (*name == store->dir_sep) - name++; - } - return name; -} - static void imap_append_offline (CamelFolder *folder, CamelMimeMessage *message, const CamelMessageInfo *info, CamelException *ex) @@ -944,7 +923,7 @@ do_append (CamelFolder *folder, CamelMimeMessage *message, camel_object_unref (CAMEL_OBJECT (crlf_filter)); camel_object_unref (CAMEL_OBJECT (memstream)); - response = camel_imap_command (store, NULL, ex, "APPEND %S%s%s {%d}", + response = camel_imap_command (store, NULL, ex, "APPEND %F%s%s {%d}", folder->full_name, flagstr ? " " : "", flagstr ? flagstr : "", ba->len); g_free (flagstr); @@ -1166,7 +1145,7 @@ do_copy (CamelFolder *source, GPtrArray *uids, char *set; set = imap_uid_array_to_set (source->summary, uids); - response = camel_imap_command (store, source, ex, "UID COPY %s %S", + response = camel_imap_command (store, source, ex, "UID COPY %s %F", set, destination->full_name); if (response && (store->capabilities & IMAP_CAPABILITY_UIDPLUS)) handle_copyuid (response, source, destination); -- cgit