[Telepathy-commits] [telepathy-glib/master] TpTextMixin: add tp_text_mixin_set_rescued

Simon McVittie simon.mcvittie at collabora.co.uk
Thu Oct 30 05:40:39 PDT 2008


---
 docs/reference/telepathy-glib-sections.txt |    1 +
 telepathy-glib/text-mixin.c                |   26 ++++++++++++++++++++++++++
 telepathy-glib/text-mixin.h                |    1 +
 3 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/docs/reference/telepathy-glib-sections.txt b/docs/reference/telepathy-glib-sections.txt
index 01a7324..c151e22 100644
--- a/docs/reference/telepathy-glib-sections.txt
+++ b/docs/reference/telepathy-glib-sections.txt
@@ -1516,6 +1516,7 @@ tp_text_mixin_list_pending_messages
 tp_text_mixin_get_message_types
 tp_text_mixin_clear
 tp_text_mixin_has_pending_messages
+tp_text_mixin_set_rescued
 tp_text_mixin_iface_init
 <SUBSECTION Private>
 TP_TEXT_MIXIN_CLASS_OFFSET_QUARK
diff --git a/telepathy-glib/text-mixin.c b/telepathy-glib/text-mixin.c
index 2479bdb..b9b54ff 100644
--- a/telepathy-glib/text-mixin.c
+++ b/telepathy-glib/text-mixin.c
@@ -603,6 +603,32 @@ tp_text_mixin_has_pending_messages (GObject *obj,
   return (msg != NULL);
 }
 
+/* FIXME: when we merge spec 0.17.14, use the proper constant */
+#define TP_CHANNEL_TEXT_MESSAGE_FLAG_RESCUED ((TpChannelTextMessageFlags) 8)
+
+/**
+ * tp_text_mixin_set_rescued:
+ * @obj: An object with this mixin
+ *
+ * Mark all pending messages as having been "rescued" from a channel that
+ * previously closed.
+ */
+void
+tp_text_mixin_set_rescued (GObject *obj)
+{
+  TpTextMixin *mixin = TP_TEXT_MIXIN (obj);
+  GList *cur;
+
+  for (cur = g_queue_peek_head_link (mixin->priv->pending);
+       cur != NULL;
+       cur = cur->next)
+    {
+      _PendingMessage *msg = cur->data;
+
+      msg->flags |= TP_CHANNEL_TEXT_MESSAGE_FLAG_RESCUED;
+    }
+}
+
 /**
  * tp_text_mixin_iface_init:
  * @g_iface: A pointer to the #TpSvcChannelTypeTextClass in an object class
diff --git a/telepathy-glib/text-mixin.h b/telepathy-glib/text-mixin.h
index 4f837c1..0c2c6ef 100644
--- a/telepathy-glib/text-mixin.h
+++ b/telepathy-glib/text-mixin.h
@@ -99,6 +99,7 @@ void tp_text_mixin_clear (GObject *obj);
 
 gboolean tp_text_mixin_has_pending_messages (GObject *obj,
     TpHandle *first_sender);
+void tp_text_mixin_set_rescued (GObject *obj);
 
 void tp_text_mixin_iface_init (gpointer g_iface, gpointer iface_data);
 
-- 
1.5.6.5




More information about the Telepathy-commits mailing list