aboutsummaryrefslogtreecommitdiffstats
path: root/camel
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2001-05-03 03:53:53 +0800
committerDan Winship <danw@src.gnome.org>2001-05-03 03:53:53 +0800
commitd0edb931396f444394f70c61c6dd1031630b9970 (patch)
tree34f81490a44241b78322777b742d061d481fad54 /camel
parentfec8edd6818c7f7fd64ae305dbb75574e73a6581 (diff)
downloadgsoc2013-evolution-d0edb931396f444394f70c61c6dd1031630b9970.tar
gsoc2013-evolution-d0edb931396f444394f70c61c6dd1031630b9970.tar.gz
gsoc2013-evolution-d0edb931396f444394f70c61c6dd1031630b9970.tar.bz2
gsoc2013-evolution-d0edb931396f444394f70c61c6dd1031630b9970.tar.lz
gsoc2013-evolution-d0edb931396f444394f70c61c6dd1031630b9970.tar.xz
gsoc2013-evolution-d0edb931396f444394f70c61c6dd1031630b9970.tar.zst
gsoc2013-evolution-d0edb931396f444394f70c61c6dd1031630b9970.zip
Clean this up a bit. Add a "tag_prefix" member. Move "useful_lsub" into
* providers/imap/camel-imap-store.h: Clean this up a bit. Add a "tag_prefix" member. Move "useful_lsub" into capabilities. * providers/imap/camel-imap-store.c (camel_imap_store_init): Initialize the tag_prefix, based on a static variable. * providers/imap/camel-imap-command.c (camel_imap_command): Use the store's tag_prefix character rather than "A" at the start of the tag. Makes the verbose debug output easier to parse when connected to multiple IMAP servers. (Well, unless you're connected to more than 26 servers...) svn path=/trunk/; revision=9649
Diffstat (limited to 'camel')
-rw-r--r--camel/ChangeLog12
-rw-r--r--camel/providers/imap/camel-imap-command.c4
-rw-r--r--camel/providers/imap/camel-imap-store.c13
-rw-r--r--camel/providers/imap/camel-imap-store.h20
4 files changed, 31 insertions, 18 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index 74da010682..4903f69e6a 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,5 +1,17 @@
2001-05-02 Dan Winship <danw@ximian.com>
+ * providers/imap/camel-imap-store.h: Clean this up a bit. Add a
+ "tag_prefix" member. Move "useful_lsub" into capabilities.
+
+ * providers/imap/camel-imap-store.c (camel_imap_store_init):
+ Initialize the tag_prefix, based on a static variable.
+
+ * providers/imap/camel-imap-command.c (camel_imap_command): Use
+ the store's tag_prefix character rather than "A" at the start of
+ the tag. Makes the verbose debug output easier to parse when
+ connected to multiple IMAP servers. (Well, unless you're connected
+ to more than 26 servers...)
+
* providers/imap/camel-imap-utils.c (imap_uid_array_to_set): Fix
this up... it was losing count in some cases and giving a more
verbose answer than it needed to.
diff --git a/camel/providers/imap/camel-imap-command.c b/camel/providers/imap/camel-imap-command.c
index 3c36dbfb03..4102d47cc5 100644
--- a/camel/providers/imap/camel-imap-command.c
+++ b/camel/providers/imap/camel-imap-command.c
@@ -128,8 +128,8 @@ camel_imap_command (CamelImapStore *store, CamelFolder *folder,
va_end (ap);
camel_remote_store_send_string (CAMEL_REMOTE_STORE (store), ex,
- "A%.5d %s\r\n", store->command++,
- cmdbuf);
+ "%c%.5d %s\r\n", store->tag_prefix,
+ store->command++, cmdbuf);
g_free (cmdbuf);
if (camel_exception_is_set (ex)) {
CAMEL_IMAP_STORE_UNLOCK (store, command_lock);
diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c
index 8511b3e9f7..42c2f12cde 100644
--- a/camel/providers/imap/camel-imap-store.c
+++ b/camel/providers/imap/camel-imap-store.c
@@ -54,12 +54,11 @@
#include "camel-imap-private.h"
#include "camel-private.h"
-#define d(x) x
-
/* Specified in RFC 2060 */
#define IMAP_PORT 143
static CamelRemoteStoreClass *remote_store_class = NULL;
+static char imap_tag_prefix = 'A';
static void construct (CamelService *service, CamelSession *session,
CamelProvider *provider, CamelURL *url,
@@ -169,10 +168,13 @@ camel_imap_store_init (gpointer object, gpointer klass)
imap_store->dir_sep = '\0';
imap_store->current_folder = NULL;
-
imap_store->connected = FALSE;
imap_store->subscribed_folders = NULL;
+ imap_store->tag_prefix = imap_tag_prefix++;
+ if (imap_tag_prefix > 'Z')
+ imap_tag_prefix = 'A';
+
imap_store->priv = g_malloc0 (sizeof (*imap_store->priv));
#ifdef ENABLE_THREADS
imap_store->priv->command_lock = e_mutex_new(E_MUTEX_REC);
@@ -653,7 +655,7 @@ imap_store_setup_online (CamelImapStore *store, CamelException *ex)
if (!imap_parse_list_response (result, &flags, NULL, &name))
continue;
if (flags & (IMAP_LIST_FLAG_MARKED | IMAP_LIST_FLAG_UNMARKED))
- store->useful_lsub = TRUE;
+ store->capabilities |= IMAP_CAPABILITY_useful_lsub;
if (flags & IMAP_LIST_FLAG_NOSELECT) {
g_free (name);
continue;
@@ -1161,7 +1163,8 @@ get_folder_info (CamelStore *store, const char *top, gboolean fast,
* use get_subscribed_folders_by_hand. In all other
* cases, use a single LIST or LSUB command.
*/
- if (subscribed_only && !imap_store->useful_lsub &&
+ if (subscribed_only &&
+ !(imap_store->capabilities & IMAP_CAPABILITY_useful_lsub) &&
(imap_store->parameters & IMAP_PARAM_CHECK_ALL)) {
get_subscribed_folders_by_hand (imap_store, name,
folders, ex);
diff --git a/camel/providers/imap/camel-imap-store.h b/camel/providers/imap/camel-imap-store.h
index fb4be047c2..b05e525845 100644
--- a/camel/providers/imap/camel-imap-store.h
+++ b/camel/providers/imap/camel-imap-store.h
@@ -52,6 +52,7 @@ typedef enum {
#define IMAP_CAPABILITY_NAMESPACE (1 << 3)
#define IMAP_CAPABILITY_UIDPLUS (1 << 4)
#define IMAP_CAPABILITY_LITERALPLUS (1 << 5)
+#define IMAP_CAPABILITY_useful_lsub (1 << 6)
#define IMAP_PARAM_OVERRIDE_NAMESPACE (1 << 0)
#define IMAP_PARAM_CHECK_ALL (1 << 1)
@@ -61,20 +62,17 @@ struct _CamelImapStore {
CamelRemoteStore parent_object;
struct _CamelImapStorePrivate *priv;
- CamelFolder *current_folder;
-
+ /* Information about the command channel / connection status */
+ gboolean connected;
+ char tag_prefix;
guint32 command;
-
+ CamelFolder *current_folder;
+
+ /* Information about the server */
CamelImapServerLevel server_level;
guint32 capabilities, parameters;
- GHashTable *authtypes;
-
- char *namespace, dir_sep, *storage_path, *base_url;
-
- gboolean connected;
-
- GHashTable *subscribed_folders;
- gboolean useful_lsub;
+ char *namespace, dir_sep, *base_url, *storage_path;
+ GHashTable *authtypes, *subscribed_folders;
};