[Telepathy-commits] [telepathy-gabble/master] push out new MUC presences when the global presence is changed

Robert McQueen robert.mcqueen at collabora.co.uk
Tue Aug 19 10:54:04 PDT 2008


20080727035358-418b8-d648ede14a4f76af7d1556677413bcf34ca30dc2.gz
---
 src/connection.c              |    5 +++++
 tests/twisted/muc/test-muc.py |   12 ++++++++++++
 2 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/src/connection.c b/src/connection.c
index 02159f4..b32266e 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -1277,6 +1277,11 @@ _gabble_connection_signal_own_presence (GabbleConnection *self, GError **error)
   g_free (caps_hash);
   lm_message_unref (message);
 
+  /* broadcast presence to MUCs */
+  tp_channel_factory_iface_foreach (
+      (TpChannelFactoryIface *) self->muc_factory,
+      (TpChannelFunc) gabble_muc_channel_send_presence, NULL);
+
   return ret;
 }
 
diff --git a/tests/twisted/muc/test-muc.py b/tests/twisted/muc/test-muc.py
index 8aa87cb..0127b01 100644
--- a/tests/twisted/muc/test-muc.py
+++ b/tests/twisted/muc/test-muc.py
@@ -139,6 +139,18 @@ def test(q, bus, conn, stream):
     assert body.name == 'body'
     assert body.children[0] == u'goodbye'
 
+    # test that presence changes are sent via the MUC
+    conn.Presence.SetStatus({'away':{'message':'hurrah'}})
+
+    event = q.expect('stream-presence', to='chat at conf.localhost/test')
+    elem = event.stanza
+    show = [e for e in elem.elements() if e.name == 'show'][0]
+    assert show
+    assert show.children[0] == u'away'
+    status = [e for e in elem.elements() if e.name == 'status'][0]
+    assert status
+    assert status.children[0] == u'hurrah'
+
     # test that closing the channel results in an unavailable message
     text_chan.Close()
 
-- 
1.5.6.3




More information about the Telepathy-commits mailing list