diff options
author | Peter Williams <peterw@ximian.com> | 2001-08-07 03:00:32 +0800 |
---|---|---|
committer | Peter Williams <peterw@src.gnome.org> | 2001-08-07 03:00:32 +0800 |
commit | f789abbd422604206c386199c80fb5eac8e34733 (patch) | |
tree | d0a1d734f996e2f4bca6aa58d695d6489b0403b0 /camel/providers/imap/camel-imap-command.c | |
parent | d701d18f51dbc1501cafba55025a7a74466e16cd (diff) | |
download | gsoc2013-evolution-f789abbd422604206c386199c80fb5eac8e34733.tar gsoc2013-evolution-f789abbd422604206c386199c80fb5eac8e34733.tar.gz gsoc2013-evolution-f789abbd422604206c386199c80fb5eac8e34733.tar.bz2 gsoc2013-evolution-f789abbd422604206c386199c80fb5eac8e34733.tar.lz gsoc2013-evolution-f789abbd422604206c386199c80fb5eac8e34733.tar.xz gsoc2013-evolution-f789abbd422604206c386199c80fb5eac8e34733.tar.zst gsoc2013-evolution-f789abbd422604206c386199c80fb5eac8e34733.zip |
Completely hide the namespace from everything external to the IMAP code,
2001-08-06 Peter Williams <peterw@ximian.com>
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
Diffstat (limited to 'camel/providers/imap/camel-imap-command.c')
-rw-r--r-- | camel/providers/imap/camel-imap-command.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/camel/providers/imap/camel-imap-command.c b/camel/providers/imap/camel-imap-command.c index 428ecf565d..4c84b47fbb 100644 --- a/camel/providers/imap/camel-imap-command.c +++ b/camel/providers/imap/camel-imap-command.c @@ -98,7 +98,7 @@ camel_imap_command (CamelImapStore *store, CamelFolder *folder, } store->current_folder = folder; camel_object_ref (CAMEL_OBJECT (folder)); - cmd = imap_command_strdup_printf (store, "SELECT %S", + cmd = imap_command_strdup_printf (store, "SELECT %F", folder->full_name); } @@ -127,11 +127,15 @@ camel_imap_command (CamelImapStore *store, CamelFolder *folder, * @fmt can include the following %-escapes ONLY: * %s, %d, %%: as with printf * %S: an IMAP "string" (quoted string or literal) + * %F: an IMAP folder name * * %S strings will be passed as literals if the server supports LITERAL+ * and quoted strings otherwise. (%S does not support strings that * contain newlines.) * + * %F will have the imap store's namespace prepended and then be processed + * like %S. + * * On success, the store's command_lock will be locked. It will be * freed when %CAMEL_IMAP_RESPONSE_TAGGED or %CAMEL_IMAP_RESPONSE_ERROR * is returned from camel_imap_command_response(). (The lock is @@ -621,7 +625,6 @@ camel_imap_response_extract_continuation (CamelImapStore *store, return NULL; } - static char * imap_command_strdup_vprintf (CamelImapStore *store, const char *fmt, va_list ap) @@ -629,7 +632,7 @@ imap_command_strdup_vprintf (CamelImapStore *store, const char *fmt, GPtrArray *args; const char *p, *start; char *out, *op, *string; - int num, len, i; + int num, len, i, arglen; args = g_ptr_array_new (); @@ -657,12 +660,16 @@ imap_command_strdup_vprintf (CamelImapStore *store, const char *fmt, break; case 'S': + case 'F': string = va_arg (ap, char *); + arglen = strlen (string); + if (*p == 'F') + arglen += strlen (store->namespace) + 1; g_ptr_array_add (args, string); if (store->capabilities & IMAP_CAPABILITY_LITERALPLUS) - len += strlen (string) + 15; + len += arglen + 15; else - len += strlen (string) * 2; + len += arglen * 2; start = p + 1; break; @@ -704,7 +711,10 @@ imap_command_strdup_vprintf (CamelImapStore *store, const char *fmt, break; case 'S': + case 'F': string = args->pdata[i++]; + if (*p == 'F') + string = imap_namespace_concat (store, string); if (store->capabilities & IMAP_CAPABILITY_LITERALPLUS) { op += sprintf (op, "{%d+}\r\n%s", strlen (string), string); @@ -713,6 +723,8 @@ imap_command_strdup_vprintf (CamelImapStore *store, const char *fmt, op += sprintf (op, "%s", quoted); g_free (quoted); } + if (*p == 'F') + g_free (string); break; default: |