aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers/imap/camel-imap-store.c
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2000-12-19 03:17:17 +0800
committerDan Winship <danw@src.gnome.org>2000-12-19 03:17:17 +0800
commitbebb2583a8fc396f8e894f38471428c405164d37 (patch)
tree7cb797bf3ae561ce1b2095cb466f76cc765dd222 /camel/providers/imap/camel-imap-store.c
parent984596da67125fdcbcfdc1bc1c4948adc66e2f54 (diff)
downloadgsoc2013-evolution-bebb2583a8fc396f8e894f38471428c405164d37.tar
gsoc2013-evolution-bebb2583a8fc396f8e894f38471428c405164d37.tar.gz
gsoc2013-evolution-bebb2583a8fc396f8e894f38471428c405164d37.tar.bz2
gsoc2013-evolution-bebb2583a8fc396f8e894f38471428c405164d37.tar.lz
gsoc2013-evolution-bebb2583a8fc396f8e894f38471428c405164d37.tar.xz
gsoc2013-evolution-bebb2583a8fc396f8e894f38471428c405164d37.tar.zst
gsoc2013-evolution-bebb2583a8fc396f8e894f38471428c405164d37.zip
Change the semantics of fmt: Now %S (capital S) means an IMAP "string",
* providers/imap/camel-imap-command.c (camel_imap_command): Change the semantics of fmt: Now %S (capital S) means an IMAP "string", (which can be sent as either a quoted string or a literal). If the server supports LITERAL+, these will be sent as extended literals (which don't require any special escaping). Otherwise they'll be sent as quoted strings (and it now properly deals with " or \ in the string). (imap_command_strdup_vprintf): Utility routine that does the real work for the functionality mentioned above. * providers/imap/camel-imap-utils.c (imap_quote_string): Turns a string into a proper IMAP "quoted string". * providers/imap/camel-imap-store.c: * providers/imap/camel-imap-folder.c: Use %S instead of "%s" where appropriate. svn path=/trunk/; revision=7070
Diffstat (limited to 'camel/providers/imap/camel-imap-store.c')
-rw-r--r--camel/providers/imap/camel-imap-store.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c
index 729452f002..6a87aec3ad 100644
--- a/camel/providers/imap/camel-imap-store.c
+++ b/camel/providers/imap/camel-imap-store.c
@@ -352,7 +352,7 @@ imap_connect (CamelService *service, CamelException *ex)
}
response = camel_imap_command (store, NULL, ex,
- "LOGIN \"%s\" \"%s\"",
+ "LOGIN %S %S",
service->url->user,
service->url->passwd);
if (!response) {
@@ -385,7 +385,7 @@ imap_connect (CamelService *service, CamelException *ex)
* for the given path, even if that path doesn't exist.
*/
response = camel_imap_command (store, NULL, ex,
- "LIST \"%s\" \"\"",
+ "LIST %S \"\"",
namespace);
} else {
/* Plain IMAP4 doesn't have that idiom, so we fall back
@@ -393,7 +393,7 @@ imap_connect (CamelService *service, CamelException *ex)
* the folder doesn't exist (eg, if namespace is "").
*/
response = camel_imap_command (store, NULL, ex,
- "LIST \"\" \"%s\"",
+ "LIST \"\" %S",
namespace);
}
if (!response)
@@ -457,7 +457,7 @@ imap_folder_exists (CamelImapStore *store, const char *folder_name,
return TRUE;
}
- response = camel_imap_command (store, NULL, ex, "LIST \"\" \"%s\"",
+ response = camel_imap_command (store, NULL, ex, "LIST \"\" %S",
folder_name);
if (!response)
return FALSE;
@@ -487,7 +487,7 @@ imap_create (CamelImapStore *store, const char *folder_name,
{
CamelImapResponse *response;
- response = camel_imap_command (store, NULL, ex, "CREATE \"%s\"",
+ response = camel_imap_command (store, NULL, ex, "CREATE %S",
folder_name);
camel_imap_response_free (response);
@@ -622,7 +622,7 @@ get_folder_info (CamelStore *store, const char *top, gboolean fast,
name = "";
}
response = camel_imap_command (imap_store, NULL, ex,
- "LIST \"\" \"%s\"", name);
+ "LIST \"\" %S", name);
if (!response)
return FALSE;
list = camel_imap_response_extract (response, "LIST", ex);
@@ -637,15 +637,17 @@ get_folder_info (CamelStore *store, const char *top, gboolean fast,
}
if (!top && subscribed_only)
- pattern = g_strdup ("");
+ pattern = g_strdup (recursive ? "*" : "%");
else if (*name)
- pattern = g_strdup_printf ("%s%c", name, imap_store->dir_sep);
+ pattern = g_strdup_printf ("%s%c%c", name, imap_store->dir_sep,
+ recursive ? '*' : '%');
else
- pattern = g_strdup (name);
+ pattern = g_strdup_printf ("%s%c", name,
+ recursive ? '*' : '%');
response = camel_imap_command (imap_store, NULL, ex,
- "%s \"\" \"%s%c\"",
+ "%s \"\" %S",
subscribed_only ? "LSUB" : "LIST",
- pattern, recursive ? '*' : '%');
+ pattern);
g_free (pattern);
if (!response)
return NULL;
@@ -696,7 +698,7 @@ get_folder_info (CamelStore *store, const char *top, gboolean fast,
response = camel_imap_command (
imap_store, NULL, NULL,
- "STATUS \"%s\" (MESSAGES UNSEEN)",
+ "STATUS %S (MESSAGES UNSEEN)",
fi->full_name);
if (!response)
continue;
@@ -749,7 +751,7 @@ subscribe_folder (CamelStore *store, const char *folder_name,
CamelImapResponse *response;
response = camel_imap_command (imap_store, NULL, ex,
- "SUBSCRIBE \"%s\"", folder_name);
+ "SUBSCRIBE %S", folder_name);
if (response) {
g_hash_table_insert (imap_store->subscribed_folders,
g_strdup (folder_name),
@@ -767,7 +769,7 @@ unsubscribe_folder (CamelStore *store, const char *folder_name,
gpointer key, value;
response = camel_imap_command (imap_store, NULL, ex,
- "UNSUBSCRIBE \"%s\"", folder_name);
+ "UNSUBSCRIBE %S", folder_name);
if (response) {
g_hash_table_lookup_extended (imap_store->subscribed_folders,
folder_name, &key, &value);