[Telepathy-commits] [telepathy-gabble/master] Correctly set the creator attribute

Sjoerd Simons sjoerd.simons at collabora.co.uk
Sun Mar 1 14:48:12 PST 2009


---
 src/jingle-content.c |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/jingle-content.c b/src/jingle-content.c
index 68a639d..4e5edb5 100644
--- a/src/jingle-content.c
+++ b/src/jingle-content.c
@@ -66,7 +66,6 @@ struct _GabbleJingleContentPrivate
 {
   gchar *name;
   gchar *creator;
-  gboolean created_by_initiator;
   gboolean created_by_us;
   JingleContentState state;
   JingleContentSenders senders;
@@ -106,7 +105,6 @@ gabble_jingle_content_init (GabbleJingleContent *obj)
   obj->priv = priv;
 
   priv->state = JINGLE_CONTENT_STATE_EMPTY;
-  priv->created_by_initiator = TRUE;
   priv->created_by_us = TRUE;
   priv->media_ready = FALSE;
   priv->transport_ready = FALSE;
@@ -538,7 +536,6 @@ gabble_jingle_content_parse_add (GabbleJingleContent *c,
     }
 
   priv->created_by_us = FALSE;
-  priv->created_by_initiator = (!tp_strdiff (creator, "initiator"));
   priv->senders = parse_senders (senders);
   if (priv->senders == JINGLE_CONTENT_SENDERS_NONE)
     {
@@ -671,12 +668,21 @@ gabble_jingle_content_produce_node (GabbleJingleContent *c,
     }
   else
     {
+      gboolean session_created_by_us;
+
       content_node = lm_message_node_add_child (parent, "content", NULL);
       lm_message_node_set_attributes (content_node,
-          "creator", priv->created_by_initiator ? "initiator" : "responder",
           "name", priv->name,
           "senders", produce_senders (priv->senders),
           NULL);
+
+      g_object_get (c->session, "local-initiator", &session_created_by_us,
+        NULL);
+
+      if (priv->created_by_us == session_created_by_us)
+        lm_message_node_set_attribute (content_node, "creator", "initiator");
+      else
+        lm_message_node_set_attribute (content_node, "creator", "responder");
     }
 
   if (!full)
-- 
1.5.6.5




More information about the telepathy-commits mailing list