aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2002-05-14 07:57:33 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2002-05-14 07:57:33 +0800
commitcc3b0ad3cd47d7d253857c9c9e11631eeab223df (patch)
treedce788da45885275a59e5365f2ece9e2d916ae5c
parent97ae540ba9fbaa9043ca02daadad363655f566dc (diff)
downloadgsoc2013-evolution-cc3b0ad3cd47d7d253857c9c9e11631eeab223df.tar
gsoc2013-evolution-cc3b0ad3cd47d7d253857c9c9e11631eeab223df.tar.gz
gsoc2013-evolution-cc3b0ad3cd47d7d253857c9c9e11631eeab223df.tar.bz2
gsoc2013-evolution-cc3b0ad3cd47d7d253857c9c9e11631eeab223df.tar.lz
gsoc2013-evolution-cc3b0ad3cd47d7d253857c9c9e11631eeab223df.tar.xz
gsoc2013-evolution-cc3b0ad3cd47d7d253857c9c9e11631eeab223df.tar.zst
gsoc2013-evolution-cc3b0ad3cd47d7d253857c9c9e11631eeab223df.zip
Overload the setv/getv CamelObject virtual methods. (imap_setv):
2002-05-13 Jeffrey Stedfast <fejj@ximian.com> * providers/imap/camel-imap-store.c (camel_imap_store_class_init): Overload the setv/getv CamelObject virtual methods. (imap_setv): Implemented. (imap_getv): Implemented. svn path=/trunk/; revision=16771
-rw-r--r--camel/ChangeLog9
-rw-r--r--camel/providers/imap/camel-imap-store.c112
-rw-r--r--camel/providers/imap/camel-imap-store.h14
3 files changed, 133 insertions, 2 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index d6d13dcc40..485b2e7e1b 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,10 @@
+2002-05-13 Jeffrey Stedfast <fejj@ximian.com>
+
+ * providers/imap/camel-imap-store.c (camel_imap_store_class_init):
+ Overload the setv/getv CamelObject virtual methods.
+ (imap_setv): Implemented.
+ (imap_getv): Implemented.
+
2002-05-13 Dan Winship <danw@ximian.com>
* camel-folder.c (camel_folder_append_message): Add a "char
@@ -63,7 +70,7 @@
* providers/imap/camel-imap-folder.c (imap_get_message): Fetch the
BODYSTRUCTURE rather than BODY since BODY seems to be lacking some
- of the data we need. This fixes bug #24131.
+ of the data we need. This fixes bug #24136.
* camel-transport.c (camel_transport_get_type): Might help if we
called camel_transport_class_init.
diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c
index 629223d935..c18c5355cb 100644
--- a/camel/providers/imap/camel-imap-store.c
+++ b/camel/providers/imap/camel-imap-store.c
@@ -67,6 +67,10 @@ static char imap_tag_prefix = 'A';
static void construct (CamelService *service, CamelSession *session,
CamelProvider *provider, CamelURL *url,
CamelException *ex);
+
+static int imap_setv (CamelObject *object, CamelException *ex, CamelArgV *args);
+static int imap_getv (CamelObject *object, CamelException *ex, CamelArgGetV *args);
+
static gboolean can_work_offline (CamelDiscoStore *disco_store);
static gboolean imap_connect_online (CamelService *service, CamelException *ex);
static gboolean imap_connect_offline (CamelService *service, CamelException *ex);
@@ -102,6 +106,8 @@ static void get_folders_online (CamelImapStore *imap_store, const char *pattern,
static void
camel_imap_store_class_init (CamelImapStoreClass *camel_imap_store_class)
{
+ CamelObjectClass *camel_object_class =
+ CAMEL_OBJECT_CLASS (camel_imap_store_class);
CamelServiceClass *camel_service_class =
CAMEL_SERVICE_CLASS (camel_imap_store_class);
CamelStoreClass *camel_store_class =
@@ -115,9 +121,12 @@ camel_imap_store_class_init (CamelImapStoreClass *camel_imap_store_class)
remote_store_class = CAMEL_REMOTE_STORE_CLASS (camel_type_get_global_classfuncs (camel_remote_store_get_type ()));
/* virtual method overload */
+ camel_object_class->setv = imap_setv;
+ camel_object_class->getv = imap_getv;
+
camel_service_class->construct = construct;
camel_service_class->query_auth_types = query_auth_types;
-
+
camel_store_class->hash_folder_name = hash_folder_name;
camel_store_class->compare_folder_name = compare_folder_name;
camel_store_class->create_folder = create_folder;
@@ -295,6 +304,107 @@ construct (CamelService *service, CamelSession *session,
}
}
+static int
+imap_setv (CamelObject *object, CamelException *ex, CamelArgV *args)
+{
+ CamelImapStore *store = (CamelImapStore *) object;
+ guint32 tag, flags;
+ int i;
+
+ for (i = 0; i < args->argc; i++) {
+ tag = args->argv[i].tag;
+
+ /* make sure this arg wasn't already handled */
+ if (tag & CAMEL_ARG_IGNORE)
+ continue;
+
+ /* make sure this is an arg we're supposed to handle */
+ if ((tag & CAMEL_ARG_TAG) <= CAMEL_IMAP_STORE_ARG_FIRST ||
+ (tag & CAMEL_ARG_TAG) >= CAMEL_IMAP_STORE_ARG_FIRST + 100)
+ continue;
+
+ if (tag == CAMEL_IMAP_STORE_NAMESPACE) {
+ if (strcmp (store->namespace, args->argv[i].ca_str) != 0) {
+ g_free (store->namespace);
+ store->namespace = g_strdup (args->argv[i].ca_str);
+ /* the current imap code will need to do a reconnect for this to take effect */
+ /*reconnect = TRUE;*/
+ }
+ } else if (tag == CAMEL_IMAP_STORE_OVERRIDE_NAMESPACE) {
+ flags = args->argv[i].ca_int ? IMAP_PARAM_OVERRIDE_NAMESPACE : 0;
+ flags |= (store->parameters & ~IMAP_PARAM_OVERRIDE_NAMESPACE);
+
+ if (store->parameters != flags) {
+ store->parameters = flags;
+ /* the current imap code will need to do a reconnect for this to take effect */
+ /*reconnect = TRUE;*/
+ }
+ } else if (tag == CAMEL_IMAP_STORE_CHECK_ALL) {
+ flags = args->argv[i].ca_int ? IMAP_PARAM_CHECK_ALL : 0;
+ flags |= (store->parameters & ~IMAP_PARAM_CHECK_ALL);
+ store->parameters = flags;
+ /* no need to reconnect for this option to take effect... */
+ } else if (tag == CAMEL_IMAP_STORE_FILTER_INBOX) {
+ flags = args->argv[i].ca_int ? IMAP_PARAM_FILTER_INBOX : 0;
+ flags |= (store->parameters & ~IMAP_PARAM_FILTER_INBOX);
+ store->parameters = flags;
+ /* no need to reconnect for this option to take effect... */
+ } else {
+ /* error?? */
+ continue;
+ }
+
+ /* let our parent know that we've handled this arg */
+ camel_argv_ignore (args, i);
+ }
+
+ /* FIXME: if we need to reconnect for a change to take affect,
+ we need to do it here... or, better yet, somehow chain it
+ up to CamelService's setv implementation. */
+
+ return CAMEL_OBJECT_CLASS (disco_store_class)->setv (object, ex, args);
+}
+
+static int
+imap_getv (CamelObject *object, CamelException *ex, CamelArgGetV *args)
+{
+ CamelImapStore *store = (CamelImapStore *) object;
+ guint32 tag;
+ int i;
+
+ for (i = 0; i < args->argc; i++) {
+ tag = args->argv[i].tag;
+
+ /* make sure this is an arg we're supposed to handle */
+ if ((tag & CAMEL_ARG_TAG) <= CAMEL_IMAP_STORE_ARG_FIRST ||
+ (tag & CAMEL_ARG_TAG) >= CAMEL_IMAP_STORE_ARG_FIRST + 100)
+ continue;
+
+ switch (tag) {
+ case CAMEL_IMAP_STORE_NAMESPACE:
+ /* get the username */
+ *args->argv[i].ca_str = store->namespace;
+ break;
+ case CAMEL_IMAP_STORE_OVERRIDE_NAMESPACE:
+ /* get the auth mechanism */
+ *args->argv[i].ca_int = store->parameters & IMAP_PARAM_OVERRIDE_NAMESPACE ? TRUE : FALSE;
+ break;
+ case CAMEL_IMAP_STORE_CHECK_ALL:
+ /* get the hostname */
+ *args->argv[i].ca_int = store->parameters & IMAP_PARAM_CHECK_ALL ? TRUE : FALSE;
+ break;
+ case CAMEL_IMAP_STORE_FILTER_INBOX:
+ /* get the port */
+ *args->argv[i].ca_int = store->parameters & IMAP_PARAM_FILTER_INBOX ? TRUE : FALSE;
+ break;
+ default:
+ /* error? */
+ }
+ }
+
+ return CAMEL_OBJECT_CLASS (disco_store_class)->getv (object, ex, args);
+}
+
static void
imap_set_server_level (CamelImapStore *store)
{
diff --git a/camel/providers/imap/camel-imap-store.h b/camel/providers/imap/camel-imap-store.h
index 9a6c6655ad..0865a52e09 100644
--- a/camel/providers/imap/camel-imap-store.h
+++ b/camel/providers/imap/camel-imap-store.h
@@ -58,6 +58,20 @@ void camel_imap_msg_queue(CamelImapStore *store, CamelImapMsg *msg);
#define CAMEL_IMAP_STORE_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_IMAP_STORE_TYPE, CamelImapStoreClass))
#define CAMEL_IS_IMAP_STORE(o) (CAMEL_CHECK_TYPE((o), CAMEL_IMAP_STORE_TYPE))
+enum {
+ CAMEL_IMAP_STORE_ARG_FIRST = CAMEL_DISCO_STORE_ARG_FIRST + 100,
+ CAMEL_IMAP_STORE_ARG_NAMESPACE,
+ CAMEL_IMAP_STORE_ARG_OVERRIDE_NAMESPACE,
+ CAMEL_IMAP_STORE_ARG_CHECK_ALL,
+ CAMEL_IMAP_STORE_ARG_FILTER_INBOX
+};
+
+#define CAMEL_IMAP_STORE_NAMESPACE (CAMEL_IMAP_STORE_ARG_NAMESPACE | CAMEL_ARG_STR)
+#define CAMEL_IMAP_STORE_OVERRIDE_NAMESPACE (CAMEL_IMAP_STORE_ARG_OVERRIDE_NAMESPACE | CAMEL_ARG_INT)
+#define CAMEL_IMAP_STORE_CHECK_ALL (CAMEL_IMAP_STORE_ARG_CHECK_ALL | CAMEL_ARG_INT)
+#define CAMEL_IMAP_STORE_FILTER_INBOX (CAMEL_IMAP_STORE_ARG_FILTER_INBOX | CAMEL_ARG_INT)
+
+
typedef enum {
IMAP_LEVEL_UNKNOWN,
IMAP_LEVEL_IMAP4,