summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Dufresne <nicolas.dufresne@collabora.co.uk>2011-03-16 14:51:13 -0400
committerNicolas Dufresne <nicolas.dufresne@collabora.co.uk>2011-03-16 14:51:13 -0400
commit6542c1cfb2c7aa5ee23158ec54d52fb6cc9d19b4 (patch)
tree1cd4a147d24f196d0e77b3d73f78cabde7591e28
parentba59d9abcdbd831792ef04be973b79a5827187eb (diff)
Store initially pending messages
This works as long as the logger won't crash. If the logger crash, it will log again the pending, creating duplicates. More patch coming to address the case where the logger crash and restart.
-rw-r--r--telepathy-logger/text-channel.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/telepathy-logger/text-channel.c b/telepathy-logger/text-channel.c
index 89e7a00..d23bd71 100644
--- a/telepathy-logger/text-channel.c
+++ b/telepathy-logger/text-channel.c
@@ -511,6 +511,25 @@ on_message_sent_cb (TpChannel *proxy,
static void
+pendingproc_store_pending_messages (TplActionChain *ctx,
+ gpointer user_data)
+{
+ TplTextChannel *self = _tpl_action_chain_get_object (ctx);
+ GList *pending_messages;
+ GList *it;
+
+ pending_messages =
+ tp_text_channel_get_pending_messages (TP_TEXT_CHANNEL (self));
+
+ for (it = pending_messages; it != NULL; it = g_list_next (it))
+ on_message_received_cb (TP_TEXT_CHANNEL (self),
+ TP_SIGNALLED_MESSAGE (it->data), self);
+
+ _tpl_action_chain_continue (ctx);
+}
+
+
+static void
pendingproc_connect_message_signals (TplActionChain *ctx,
gpointer user_data)
{
@@ -549,6 +568,7 @@ tpl_text_channel_prepare_async (TplChannel *chan,
_tpl_action_chain_append (actions, pendingproc_prepare_tp_text_channel, NULL);
_tpl_action_chain_append (actions, pendingproc_get_my_contact, NULL);
_tpl_action_chain_append (actions, pendingproc_get_remote_contacts, NULL);
+ _tpl_action_chain_append (actions, pendingproc_store_pending_messages, NULL);
_tpl_action_chain_append (actions, pendingproc_connect_message_signals, NULL);
_tpl_action_chain_continue (actions);