[Telepathy-commits] [telepathy-sofiasip/master] Set the flag Channel_Text_Message_Flag_Resqued on pending messages of a resurrected text channel

Mikhail Zabaluev mikhail.zabaluev at nokia.com
Tue Nov 18 10:56:16 PST 2008


---
 src/sip-text-channel.c        |   15 ++++++++++++---
 tests/twisted/test-message.py |    8 ++++++++
 2 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/src/sip-text-channel.c b/src/sip-text-channel.c
index 67370e0..19209cc 100644
--- a/src/sip-text-channel.c
+++ b/src/sip-text-channel.c
@@ -103,6 +103,7 @@ struct _TpsipTextPendingMessage
   time_t timestamp;
   TpHandle sender;
   TpChannelTextMessageType type;
+  guint flags;
   gchar *text;
 
   nua_handle_t *nh;
@@ -612,8 +613,18 @@ tpsip_text_channel_close (TpSvcChannel *iface,
         }
       else
         {
+          GList *cur;
+
           DEBUG ("not really closing, there are pending messages left");
 
+          for (cur = g_queue_peek_head_link (priv->pending_messages);
+               cur != NULL;
+               cur = cur->next)
+            {
+              TpsipTextPendingMessage *msg = cur->data;
+              msg->flags |= TP_CHANNEL_TEXT_MESSAGE_FLAG_RESCUED;
+            }
+
           if (priv->initiator != priv->handle)
             {
               TpHandleRepoIface *contact_repo = tp_base_connection_get_handles
@@ -626,8 +637,6 @@ tpsip_text_channel_close (TpSvcChannel *iface,
               priv->initiator = priv->handle;
               tp_handle_ref (contact_repo, priv->initiator);
             }
-
-          /* XXX: clear the queue of messages awaiting sent confirmation? */
         }
       tp_svc_channel_emit_closed (self);
     }
@@ -748,7 +757,7 @@ tpsip_pending_message_list_add (GPtrArray *list, TpsipTextPendingMessage *msg)
                           1, msg->timestamp,
                           2, msg->sender,
                           3, msg->type,
-                          4, 0 /* msg->flags */,
+                          4, msg->flags,
                           5, msg->text,
                           G_MAXUINT);
 
diff --git a/tests/twisted/test-message.py b/tests/twisted/test-message.py
index 4fa4d80..280ba55 100644
--- a/tests/twisted/test-message.py
+++ b/tests/twisted/test-message.py
@@ -158,6 +158,9 @@ def test(q, bus, conn, sip):
         initiator_uri=contact,
         requested=False)
 
+    # Expect Channel_Text_Message_Flag_Resqued to be set
+    pending_msgs = [message_with_resqued(msg) for msg in pending_msgs]
+
     iface = dbus.Interface(requested_obj, TEXT_TYPE)
 
     pending_res = iface.ListPendingMessages(False)
@@ -222,6 +225,11 @@ def send_message(sip, destVia, body, encoding=None, sender=FROM_URL):
     sip.sendMessage(destAddr, msg)
     return True
 
+def message_with_resqued(msg):
+    l = list(msg)
+    l[4] = 8
+    return tuple(l)
+
 if __name__ == '__main__':
     exec_test(test)
 
-- 
1.5.6.5




More information about the Telepathy-commits mailing list