aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-session.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2002-08-21 05:44:29 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2002-08-21 05:44:29 +0800
commit164f4653dd98cd41fc7e3dd64b09145dec04bed8 (patch)
tree04d58b72775bf962314eb9a98870408407f6f48e /camel/camel-session.c
parent07c805c9f58f4b025960ea5718f4e1448bf9c4cc (diff)
downloadgsoc2013-evolution-164f4653dd98cd41fc7e3dd64b09145dec04bed8.tar
gsoc2013-evolution-164f4653dd98cd41fc7e3dd64b09145dec04bed8.tar.gz
gsoc2013-evolution-164f4653dd98cd41fc7e3dd64b09145dec04bed8.tar.bz2
gsoc2013-evolution-164f4653dd98cd41fc7e3dd64b09145dec04bed8.tar.lz
gsoc2013-evolution-164f4653dd98cd41fc7e3dd64b09145dec04bed8.tar.xz
gsoc2013-evolution-164f4653dd98cd41fc7e3dd64b09145dec04bed8.tar.zst
gsoc2013-evolution-164f4653dd98cd41fc7e3dd64b09145dec04bed8.zip
Override the default noop implementation.
2002-08-20 Jeffrey Stedfast <fejj@ximian.com> * providers/imap/camel-imap-store.c (imap_noop): Override the default noop implementation. * camel-store.c (camel_store_noop): New virtual method to ping a store. * camel-session.c (get_service): Register a timeout that calls camel_store_noop() every 10 minutes. svn path=/trunk/; revision=17822
Diffstat (limited to 'camel/camel-session.c')
-rw-r--r--camel/camel-session.c40
1 files changed, 38 insertions, 2 deletions
diff --git a/camel/camel-session.c b/camel/camel-session.c
index 0cf493ae80..b65d460211 100644
--- a/camel/camel-session.c
+++ b/camel/camel-session.c
@@ -398,6 +398,29 @@ service_cache_remove (CamelService *service, gpointer event_data, gpointer user_
CAMEL_SESSION_UNLOCK(session, lock);
}
+static gboolean
+noop_cb (gpointer user_data)
+{
+ CamelStore *store = (CamelStore *) user_data;
+ CamelException ex;
+
+ camel_exception_init (&ex);
+ camel_store_noop (store, &ex);
+ camel_exception_clear (&ex);
+
+ return TRUE;
+}
+
+static void
+unregister_noop (CamelObject *object, gpointer event_data, gpointer user_data)
+{
+ CamelService *service = (CamelService *) object;
+ guint id;
+
+ id = GPOINTER_TO_INT (user_data);
+
+ camel_session_remove_timeout (service->session, id);
+}
static CamelService *
get_service (CamelSession *session, const char *url_string,
@@ -407,6 +430,7 @@ get_service (CamelSession *session, const char *url_string,
CamelProvider *provider;
CamelService *service;
CamelException internal_ex;
+
url = camel_url_new (url_string, ex);
if (!url)
return NULL;
@@ -420,6 +444,7 @@ get_service (CamelSession *session, const char *url_string,
url->protocol);
provider = NULL;
}
+
if (!provider) {
camel_url_free (url);
return NULL;
@@ -430,7 +455,7 @@ get_service (CamelSession *session, const char *url_string,
*/
if (url->path && !CAMEL_PROVIDER_ALLOWS (provider, CAMEL_URL_PART_PATH))
camel_url_set_path (url, NULL);
-
+
/* Now look up the service in the provider's cache */
service = g_hash_table_lookup (provider->service_cache[type], url);
if (service != NULL) {
@@ -447,8 +472,19 @@ get_service (CamelSession *session, const char *url_string,
camel_object_unref (CAMEL_OBJECT (service));
service = NULL;
} else {
+ if (type == CAMEL_PROVIDER_STORE) {
+ guint id;
+
+ id = camel_session_register_timeout (session, 36000, noop_cb, service);
+ camel_object_hook_event (CAMEL_OBJECT (service), "finalize",
+ (CamelObjectEventHookFunc) unregister_noop,
+ GINT_TO_POINTER (id));
+ }
+
g_hash_table_insert (provider->service_cache[type], url, service);
- camel_object_hook_event (CAMEL_OBJECT (service), "finalize", (CamelObjectEventHookFunc) service_cache_remove, GINT_TO_POINTER (type));
+ camel_object_hook_event (CAMEL_OBJECT (service), "finalize",
+ (CamelObjectEventHookFunc) service_cache_remove,
+ GINT_TO_POINTER (type));
}
return service;