aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mail/ChangeLog7
-rw-r--r--mail/mail-folder-cache.c59
2 files changed, 62 insertions, 4 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index c12c7a5815..c210a026ad 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,5 +1,12 @@
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.
+
+2002-08-21 Jeffrey Stedfast <fejj@ximian.com>
+
* mail-session.c (class_init): Don't bother overloading the
timeout virtual methods since they don't exist anymore.
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