[telepathy-gabble/master] Don't hide subscribe:rp contacts from stored

Will Thompson will.thompson at collabora.co.uk
Fri Jul 17 09:46:27 PDT 2009


---
 src/roster.c                               |   10 +++++++++-
 tests/twisted/roster/test-google-roster.py |   26 ++++++++++++++------------
 2 files changed, 23 insertions(+), 13 deletions(-)

diff --git a/src/roster.c b/src/roster.c
index b600812..75fa032 100644
--- a/src/roster.c
+++ b/src/roster.c
@@ -1326,7 +1326,15 @@ got_roster_iq (GabbleRoster *roster,
             case GABBLE_ROSTER_SUBSCRIPTION_TO:
             case GABBLE_ROSTER_SUBSCRIPTION_FROM:
             case GABBLE_ROSTER_SUBSCRIPTION_BOTH:
-              if (google_roster && !_google_roster_item_should_keep (jid, item))
+              if (google_roster &&
+                  /* Don't hide contacts from stored if they're remote pending.
+                   * This works around Google Talk flickering ask="subscribe"
+                   * when you try to subscribe to someone; see
+                   * test-google-roster.py.
+                   */
+                  !tp_handle_set_is_member (sub_chan->group.remote_pending,
+                      handle) &&
+                  !_google_roster_item_should_keep (jid, item))
                 tp_intset_add (stored_rem, handle);
               else
                 tp_intset_add (stored_add, handle);
diff --git a/tests/twisted/roster/test-google-roster.py b/tests/twisted/roster/test-google-roster.py
index f098267..8c4f058 100644
--- a/tests/twisted/roster/test-google-roster.py
+++ b/tests/twisted/roster/test-google-roster.py
@@ -140,11 +140,15 @@ def test(q, bus, conn, stream):
             predicate=is_subscribe),
         )
 
-    # Gabble shouldn't report any changes to subscribe's members in response to
-    # the next two roster updates.
-    change_event = [EventPattern('dbus-signal', signal='MembersChanged',
-        predicate=is_subscribe)]
-    q.forbid_events(change_event)
+    # Gabble shouldn't report any changes to subscribe or stored's members in
+    # response to the next two roster updates.
+    change_events = [
+        EventPattern('dbus-signal', signal='MembersChanged',
+            predicate=is_subscribe),
+        EventPattern('dbus-signal', signal='MembersChanged',
+            predicate=is_stored),
+        ]
+    q.forbid_events(change_events)
 
     # Send roster update 2: none
     iq = make_set_roster_iq(stream, 'test at localhost/Resource', contact,
@@ -160,7 +164,7 @@ def test(q, bus, conn, stream):
     # list
     sync_stream(q, stream)
     sync_dbus(bus, q, conn)
-    q.unforbid_events(change_event)
+    q.unforbid_events(change_events)
 
     # Also, when the contact accepts the subscription request, they flicker
     # similarly:
@@ -185,11 +189,9 @@ def test(q, bus, conn, stream):
         args=['', [handle], [], [], [], 0, cs.GC_REASON_NONE],
         predicate=is_subscribe)
 
-    # Gabble shouldn't report any changes to subscribe's members in response to
-    # the next two roster updates.
-    change_event = [EventPattern('dbus-signal', signal='MembersChanged',
-        predicate=is_subscribe)]
-    q.forbid_events(change_event)
+    # Gabble shouldn't report any changes to subscribe or stored's members in
+    # response to the next two roster updates.
+    q.forbid_events(change_events)
 
     # Send roster update 2: subscription=none, ask=subscribe (pending again)
     iq = make_set_roster_iq(stream, 'test at localhost/Resource', contact,
@@ -205,7 +207,7 @@ def test(q, bus, conn, stream):
     # list
     sync_stream(q, stream)
     sync_dbus(bus, q, conn)
-    q.unforbid_events(change_event)
+    q.unforbid_events(change_events)
 
 if __name__ == '__main__':
     exec_test(test, protocol=GoogleXmlStream)
-- 
1.5.6.5




More information about the telepathy-commits mailing list