From d92500bcd3911dbddad5fff2d40cfbc674663b41 Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Wed, 26 Oct 2011 16:19:58 +0200 Subject: [PATCH] actually implement ContactBlocking interface https://bugs.freedesktop.org/show_bug.cgi?id=42281 --- src/connection.c | 2 ++ tests/twisted/roster/test-google-roster.py | 13 ++++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/connection.c b/src/connection.c index 74e58e7..ad58ebb 100644 --- a/src/connection.c +++ b/src/connection.c @@ -118,6 +118,8 @@ G_DEFINE_TYPE_WITH_CODE(GabbleConnection, tp_base_contact_list_mixin_list_iface_init); G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CONNECTION_INTERFACE_CONTACT_GROUPS, tp_base_contact_list_mixin_groups_iface_init); + G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CONNECTION_INTERFACE_CONTACT_BLOCKING, + tp_base_contact_list_mixin_blocking_iface_init); G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CONNECTION_INTERFACE_SIMPLE_PRESENCE, tp_presence_mixin_simple_presence_iface_init); G_IMPLEMENT_INTERFACE (GABBLE_TYPE_SVC_CONNECTION_INTERFACE_GABBLE_DECLOAK, diff --git a/tests/twisted/roster/test-google-roster.py b/tests/twisted/roster/test-google-roster.py index d6c5598..5e52751 100644 --- a/tests/twisted/roster/test-google-roster.py +++ b/tests/twisted/roster/test-google-roster.py @@ -295,9 +295,6 @@ def test_deny_simple(q, bus, conn, stream, stored, deny): EventPattern('dbus-return', method='RemoveMembers'), ) - assertContains(cs.CONN_IFACE_CONTACT_BLOCKING, - conn.Properties.Get(cs.CONN, "Interfaces")) - # Our server sends roster pushes in response to our unsubscribe and # unsubscribed commands. stream.send(make_set_roster_iq(stream, 'test@localhost/Resource', contact, @@ -518,6 +515,15 @@ def test_deny_unblock_remove(q, bus, conn, stream, stored, deny): args=['', [], [handle], [], [], 0, cs.GC_REASON_NONE], predicate=is_stored) +def test_contact_blocking(q, bus, conn, stream, stored, deny): + """test ContactBlocking API""" + assertContains(cs.CONN_IFACE_CONTACT_BLOCKING, + conn.Properties.Get(cs.CONN, "Interfaces")) + + # 3 contacts are blocked + blocked = conn.RequestBlockedContacts(dbus_interface=cs.CONN_IFACE_CONTACT_BLOCKING) + + assertLength(3, blocked) def test(q, bus, conn, stream): publish, subscribe, stored, deny = test_inital_roster(q, bus, conn, stream) @@ -528,6 +534,7 @@ def test(q, bus, conn, stream): test_deny_overlap_two(q, bus, conn, stream, subscribe, publish, stored, deny) test_deny_unblock_remove(q, bus, conn, stream, stored, deny) + test_contact_blocking(q, bus, conn, stream, stored, deny) if __name__ == '__main__': exec_test(test, protocol=GoogleXmlStream) -- 1.7.4.1