diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2002-08-03 08:45:15 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2002-08-03 08:45:15 +0800 |
commit | 338e936539204e42bbb0a09f30eba984fa939ebc (patch) | |
tree | 1d80cf4e6104fa507b6738f0d26c32bae0dee7e1 /camel/providers/imap/camel-imap-command.c | |
parent | 6aa2b61cc756334a5ea43d41c0f5883b41d09f46 (diff) | |
download | gsoc2013-evolution-338e936539204e42bbb0a09f30eba984fa939ebc.tar.gz gsoc2013-evolution-338e936539204e42bbb0a09f30eba984fa939ebc.tar.zst gsoc2013-evolution-338e936539204e42bbb0a09f30eba984fa939ebc.zip |
Fixes bug #26237.
2002-08-02 Jeffrey Stedfast <fejj@ximian.com>
Fixes bug #26237.
* providers/imap/camel-imap-command.c
(imap_command_strdup_vprintf): Don't prepend any namespace shit in
the %F case.
* providers/imap/camel-imap-utils.c (imap_parse_list_response):
Don't strip off the namespace.
svn path=/trunk/; revision=17693
Diffstat (limited to 'camel/providers/imap/camel-imap-command.c')
-rw-r--r-- | camel/providers/imap/camel-imap-command.c | 58 |
1 files changed, 19 insertions, 39 deletions
diff --git a/camel/providers/imap/camel-imap-command.c b/camel/providers/imap/camel-imap-command.c index 49e23a944f..a0a423dc84 100644 --- a/camel/providers/imap/camel-imap-command.c +++ b/camel/providers/imap/camel-imap-command.c @@ -681,7 +681,7 @@ imap_command_strdup_vprintf (CamelImapStore *store, const char *fmt, { GPtrArray *args; const char *p, *start; - char *out, *op, *string; + char *out, *outptr, *string; int num, len, i, arglen; args = g_ptr_array_new (); @@ -701,28 +701,18 @@ imap_command_strdup_vprintf (CamelImapStore *store, const char *fmt, start = p + 1; len += 10; break; - case 's': string = va_arg (ap, char *); g_ptr_array_add (args, string); start = p + 1; len += strlen (string); break; - case 'S': case 'F': string = va_arg (ap, char *); arglen = strlen (string); - if (*p == 'F') { - if (store->namespace == NULL) { - if (*string != '\0') /*ok if foldername is "" */ - g_warning ("trying to list folder \"%s\" but no namespace. Hope for the best", string); - arglen += 2; - } else - arglen += strlen (store->namespace) + 1; - } g_ptr_array_add (args, string); - if (imap_is_atom(string)) { + if (imap_is_atom (string)) { len += arglen; } else { if (store->capabilities & IMAP_CAPABILITY_LITERALPLUS) @@ -732,11 +722,9 @@ imap_command_strdup_vprintf (CamelImapStore *store, const char *fmt, } start = p + 1; break; - case '%': start = p; break; - default: g_warning ("camel-imap-command is not printf. I don't " "know what '%%%c' means.", *p); @@ -746,62 +734,54 @@ imap_command_strdup_vprintf (CamelImapStore *store, const char *fmt, } /* Now write out the string */ - op = out = g_malloc (len + 1); + outptr = out = g_malloc (len + 1); p = start = fmt; i = 0; while (*p) { p = strchr (start, '%'); if (!p) { - strcpy (op, start); + strcpy (outptr, start); break; } else { - strncpy (op, start, p - start); - op += p - start; + strncpy (outptr, start, p - start); + outptr += p - start; } switch (*++p) { case 'd': num = GPOINTER_TO_INT (args->pdata[i++]); - op += sprintf (op, "%d", num); + outptr += sprintf (outptr, "%d", num); break; case 's': string = args->pdata[i++]; - op += sprintf (op, "%s", string); + outptr += sprintf (outptr, "%s", string); break; - case 'S': case 'F': string = args->pdata[i++]; - if (*p == 'F') { - char *mailbox; - - mailbox = imap_namespace_concat (store, string); - string = imap_mailbox_encode (mailbox, strlen (mailbox)); - g_free (mailbox); - } - - if (imap_is_atom(string)) { - op += sprintf(op, "%s", string); + if (*p == 'F') + string = imap_mailbox_encode (string, strlen (string)); + + if (imap_is_atom (string)) { + outptr += sprintf (outptr, "%s", string); } else { if (store->capabilities & IMAP_CAPABILITY_LITERALPLUS) { - op += sprintf (op, "{%d+}\r\n%s", - strlen (string), string); + outptr += sprintf (outptr, "{%d+}\r\n%s", strlen (string), string); } else { char *quoted = imap_quote_string (string); - - op += sprintf (op, "%s", quoted); + + outptr += sprintf (outptr, "%s", quoted); g_free (quoted); } } - + if (*p == 'F') g_free (string); break; - default: - *op++ = '%'; - *op++ = *p; + *outptr++ = '%'; + *outptr++ = *p; } start = *p ? p + 1 : p; |