aboutsummaryrefslogtreecommitdiffstats
path: root/mail/mail-folder-cache.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2002-08-22 04:01:46 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2002-08-22 04:01:46 +0800
commitfbe9e89258e82a7537b18c7b08858e550abcd24d (patch)
tree402811de5241f38a0fcf23ac62e23c6fa7068bbb /mail/mail-folder-cache.c
parent828a1077206a22132eccb3138d937d5c255d7f10 (diff)
downloadgsoc2013-evolution-fbe9e89258e82a7537b18c7b08858e550abcd24d.tar.gz
gsoc2013-evolution-fbe9e89258e82a7537b18c7b08858e550abcd24d.tar.zst
gsoc2013-evolution-fbe9e89258e82a7537b18c7b08858e550abcd24d.zip
Spawn a new thread to ping the server but only if it is connected.
2002-08-21 Jeffrey Stedfast <fejj@ximian.com> * mail-folder-cache.c (ping_store): Spawn a new thread to ping the server but only if it is connected. (ping_cb): This needs to return TRUE so the timeout keeps getting called. svn path=/trunk/; revision=17832
Diffstat (limited to 'mail/mail-folder-cache.c')
-rw-r--r--mail/mail-folder-cache.c59
1 files changed, 55 insertions, 4 deletions
diff --git a/mail/mail-folder-cache.c b/mail/mail-folder-cache.c
index ac88aa9442..fe818f33c4 100644
--- a/mail/mail-folder-cache.c
+++ b/mail/mail-folder-cache.c
@@ -726,15 +726,64 @@ update_folders(CamelStore *store, CamelFolderInfo *fi, void *data)
g_free(ud);
}
+
+struct _ping_store_msg {
+ struct _mail_msg msg;
+
+ CamelStore *store;
+};
+
+static char *
+ping_store_desc (struct _mail_msg *mm, int done)
+{
+ struct _ping_store_msg *m = (struct _ping_store_msg *) mm;
+ char *service_name = camel_service_get_name (CAMEL_SERVICE (m->store), TRUE);
+ char *msg;
+
+ msg = g_strdup_printf (_("Pinging %s"), service_name);
+ g_free (service_name);
+
+ return msg;
+}
+
+static void
+ping_store_ping (struct _mail_msg *mm)
+{
+ struct _ping_store_msg *m = (struct _ping_store_msg *) mm;
+
+ if (CAMEL_SERVICE (m->store)->status == CAMEL_SERVICE_CONNECTED)
+ camel_store_noop (m->store, &mm->ex);
+}
+
+static void
+ping_store_free (struct _mail_msg *mm)
+{
+ struct _ping_store_msg *m = (struct _ping_store_msg *) mm;
+
+ camel_object_unref (m->store);
+}
+
+static struct _mail_msg_op ping_store_op = {
+ ping_store_desc,
+ ping_store_ping,
+ NULL,
+ ping_store_free
+};
+
static void
ping_store (gpointer key, gpointer val, gpointer user_data)
{
CamelStore *store = (CamelStore *) key;
- CamelException ex;
+ struct _ping_store_msg *m;
+
+ if (CAMEL_SERVICE (store)->status != CAMEL_SERVICE_CONNECTED)
+ return;
+
+ m = mail_msg_new (&ping_store_op, NULL, sizeof (struct _ping_store_msg));
+ m->store = store;
+ camel_object_ref (store);
- camel_exception_init (&ex);
- camel_store_noop (store, &ex);
- camel_exception_clear (&ex);
+ e_thread_put (mail_thread_queued, (EMsg *) m);
}
static gboolean
@@ -745,6 +794,8 @@ ping_cb (gpointer user_data)
g_hash_table_foreach (stores, ping_store, NULL);
UNLOCK (info_lock);
+
+ return TRUE;
}
void