aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-session.c
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2003-09-23 02:48:34 +0800
committerMichael Zucci <zucchi@src.gnome.org>2003-09-23 02:48:34 +0800
commit6abd6e01b3f220a127c780ffdf2ea9a80f028238 (patch)
treece0575d5ed607aaf29739724859318649cf8860c /camel/camel-session.c
parent5d47e3740be4786532d412529a1d53f32ef4faf5 (diff)
downloadgsoc2013-evolution-6abd6e01b3f220a127c780ffdf2ea9a80f028238.tar
gsoc2013-evolution-6abd6e01b3f220a127c780ffdf2ea9a80f028238.tar.gz
gsoc2013-evolution-6abd6e01b3f220a127c780ffdf2ea9a80f028238.tar.bz2
gsoc2013-evolution-6abd6e01b3f220a127c780ffdf2ea9a80f028238.tar.lz
gsoc2013-evolution-6abd6e01b3f220a127c780ffdf2ea9a80f028238.tar.xz
gsoc2013-evolution-6abd6e01b3f220a127c780ffdf2ea9a80f028238.tar.zst
gsoc2013-evolution-6abd6e01b3f220a127c780ffdf2ea9a80f028238.zip
Added "offline_sync" option, which lets you synchronise all mail to local
2003-09-22 Not Zed <NotZed@Ximian.com> * 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 <NotZed@Ximian.com> * camel-session.c (session_thread_destroy): call proper entry point for freeing the message. 2003-09-18 Not Zed <NotZed@Ximian.com> * camel-folder.c (filter_filter): register the filtering process for progress, and do progress of the filtering process. 2003-09-17 Not Zed <NotZed@Ximian.com> * 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
Diffstat (limited to 'camel/camel-session.c')
-rw-r--r--camel/camel-session.c34
1 files changed, 30 insertions, 4 deletions
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: