[telepathy-gabble/master] SendersChanged should only have updates not the full set

Sjoerd Simons sjoerd.simons at collabora.co.uk
Mon Dec 14 07:14:51 PST 2009


---
 src/call-stream.c |   26 +++++++++++++++++++-------
 1 files changed, 19 insertions(+), 7 deletions(-)

diff --git a/src/call-stream.c b/src/call-stream.c
index d8f1edb..7510305 100644
--- a/src/call-stream.c
+++ b/src/call-stream.c
@@ -401,7 +401,7 @@ call_stream_update_sender_states (GabbleCallStream *self)
   JingleContentState state;
   GabbleSendingState local_state = 0;
   GabbleSendingState remote_state = 0;
-  gboolean updated = FALSE;
+  GHashTable *updates = g_hash_table_new (g_direct_hash, g_direct_equal);
 
   g_object_get (priv->content, "state", &state, NULL);
   created_by_us = gabble_jingle_content_is_created_by_us (priv->content);
@@ -422,21 +422,33 @@ call_stream_update_sender_states (GabbleCallStream *self)
         remote_state = GABBLE_SENDING_STATE_SENDING;
     }
 
-  updated = call_stream_sender_update_state (self,
-        TP_BASE_CONNECTION (priv->conn)->self_handle, local_state);
+  if (call_stream_sender_update_state (self,
+        TP_BASE_CONNECTION (priv->conn)->self_handle, local_state))
+    {
+      g_hash_table_insert (updates,
+        GUINT_TO_POINTER (TP_BASE_CONNECTION (priv->conn)->self_handle),
+        GUINT_TO_POINTER (local_state));
+    }
 
-  updated = call_stream_sender_update_state (self,
-        priv->content->session->peer, remote_state) || updated;
+  if (call_stream_sender_update_state (self,
+        priv->content->session->peer, remote_state))
+    {
+      g_hash_table_insert (updates,
+        GUINT_TO_POINTER (priv->content->session->peer),
+        GUINT_TO_POINTER (remote_state));
+    }
 
-  if (updated)
+  if (g_hash_table_size (updates) > 0)
     {
       GArray *empty = g_array_new (FALSE, TRUE, sizeof (TpHandle));
 
       gabble_svc_call_stream_emit_senders_changed (self,
-        priv->senders,
+        updates,
         empty);
       g_array_unref (empty);
     }
+
+  g_hash_table_unref (updates);
 }
 
 
-- 
1.5.6.5




More information about the telepathy-commits mailing list