From 6abd6e01b3f220a127c780ffdf2ea9a80f028238 Mon Sep 17 00:00:00 2001 From: Not Zed Date: Mon, 22 Sep 2003 18:48:34 +0000 Subject: Added "offline_sync" option, which lets you synchronise all mail to local 2003-09-22 Not Zed * providers/imap/camel-imap-provider.c: Added "offline_sync" option, which lets you synchronise all mail to local storage automagically. * camel-disco-folder.c (cdf_folder_changed): hook onto the folder changed single, for all new messages, check that they are online using another thread, if the offline_sync option has been enabled for this store. 2003-09-21 Not Zed * camel-session.c (session_thread_destroy): call proper entry point for freeing the message. 2003-09-18 Not Zed * camel-folder.c (filter_filter): register the filtering process for progress, and do progress of the filtering process. 2003-09-17 Not Zed * camel.c (camel_init): init camel operation. * camel-operation.c (camel_operation_reset): removed, not used, not worth it. (camel_operation_mute): new method to stop all status updates permanently. (*): Changed to use thread specific data and a list rather than a hashtable. (cancel_thread): removed. (camel_operation_register): return the previously registered op. svn path=/trunk/; revision=22648 --- camel/camel-session.c | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) (limited to 'camel/camel-session.c') diff --git a/camel/camel-session.c b/camel/camel-session.c index d21ccc3ae8..9d5fd7ea9f 100644 --- a/camel/camel-session.c +++ b/camel/camel-session.c @@ -67,6 +67,7 @@ static void *session_thread_msg_new(CamelSession *session, CamelSessionThreadOps static void session_thread_msg_free(CamelSession *session, CamelSessionThreadMsg *msg); static int session_thread_queue(CamelSession *session, CamelSessionThreadMsg *msg, int flags); static void session_thread_wait(CamelSession *session, int id); +static void session_thread_status(CamelSession *session, CamelSessionThreadMsg *msg, const char *text, int pc); /* The vfolder provider is always available */ static CamelProvider vee_provider = { @@ -120,7 +121,7 @@ camel_session_finalise (CamelObject *o) g_hash_table_destroy(session->priv->thread_active); if (session->priv->thread_queue) e_thread_destroy(session->priv->thread_queue); - + g_free(session->storage_path); g_hash_table_foreach_remove (session->providers, camel_session_destroy_provider, NULL); @@ -146,6 +147,7 @@ camel_session_class_init (CamelSessionClass *camel_session_class) camel_session_class->thread_msg_free = session_thread_msg_free; camel_session_class->thread_queue = session_thread_queue; camel_session_class->thread_wait = session_thread_wait; + camel_session_class->thread_status = session_thread_status; vee_provider.object_types[CAMEL_PROVIDER_STORE] = camel_vee_store_get_type (); vee_provider.url_hash = camel_url_hash; @@ -688,6 +690,14 @@ camel_session_get_filter_driver (CamelSession *session, return CS_CLASS (session)->get_filter_driver (session, type, ex); } +static void +cs_thread_status(CamelOperation *op, const char *what, int pc, void *data) +{ + CamelSessionThreadMsg *m = data; + + CS_CLASS(m->session)->thread_status(m->session, m, what, pc); +} + static void *session_thread_msg_new(CamelSession *session, CamelSessionThreadOps *ops, unsigned int size) { CamelSessionThreadMsg *m; @@ -696,7 +706,10 @@ static void *session_thread_msg_new(CamelSession *session, CamelSessionThreadOps m = g_malloc0(size); m->ops = ops; - + m->session = session; + camel_object_ref(session); + m->op = camel_operation_new(cs_thread_status, m); + camel_exception_init(&m->ex); CAMEL_SESSION_LOCK(session, thread_lock); m->id = session->priv->thread_id++; g_hash_table_insert(session->priv->thread_active, GINT_TO_POINTER(m->id), m); @@ -719,20 +732,29 @@ static void session_thread_msg_free(CamelSession *session, CamelSessionThreadMsg if (msg->ops->free) msg->ops->free(session, msg); + if (msg->op) + camel_operation_unref(msg->op); + camel_exception_clear(&msg->ex); + camel_object_unref(msg->session); g_free(msg); } static void session_thread_destroy(EThread *thread, CamelSessionThreadMsg *msg, CamelSession *session) { d(printf("destroy message %p session %p\n", msg, session)); - session_thread_msg_free(session, msg); + camel_session_thread_msg_free(session, msg); } static void session_thread_received(EThread *thread, CamelSessionThreadMsg *msg, CamelSession *session) { d(printf("receive message %p session %p\n", msg, session)); - if (msg->ops->receive) + if (msg->ops->receive) { + CamelOperation *oldop; + + oldop = camel_operation_register(msg->op); msg->ops->receive(session, msg); + camel_operation_register(oldop); + } } static int session_thread_queue(CamelSession *session, CamelSessionThreadMsg *msg, int flags) @@ -768,6 +790,10 @@ static void session_thread_wait(CamelSession *session, int id) } while (wait); } +static void session_thread_status(CamelSession *session, CamelSessionThreadMsg *msg, const char *text, int pc) +{ +} + /** * camel_session_thread_msg_new: * @session: -- cgit v1.2.3