From f53172e06c29586a32989b11cf66aa2d28368ad0 Mon Sep 17 00:00:00 2001 From: Will Thompson Date: Tue, 6 Sep 2011 16:42:08 +0100 Subject: MUC: use id='' to catch SetSubject errors Servers don't strictly have to echo the element in their reply if they reject our subject change message. But they do have to preserve the id='' attribute. This patch makes Gabble set an id='' attribute on s sent to change the subject, and look for that ID when it receives a from a MUC. (It continues to look for errors, too.) Prosody is an example of a server that behaves like this. --- tests/twisted/muc/subject.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'tests') diff --git a/tests/twisted/muc/subject.py b/tests/twisted/muc/subject.py index 0382884e3..a50413d72 100644 --- a/tests/twisted/muc/subject.py +++ b/tests/twisted/muc/subject.py @@ -185,6 +185,21 @@ def test_subject(q, bus, conn, stream, change_subject, send_first, stream.send(elem) q.expect('dbus-error', method='SetSubject', name=cs.PERMISSION_DENIED) + # Test changing the subject and getting an error back which doesn't echo + # the element. + call_async(q, chan, 'SetSubject', 'CHICKEN MAN', dbus_interface=cs.CHANNEL_IFACE_SUBJECT) + + e = q.expect('stream-message', to=room) + message = domish.Element((None, 'message')) + message['from'] = room + message['id'] = e.stanza['id'] + message['type'] = 'error' + error = message.addElement((None, 'error')) + error.addElement((ns.STANZA, 'forbidden')) + stream.send(message) + + q.expect('dbus-error', method='SetSubject', name=cs.PERMISSION_DENIED) + # Test changing the subject just before we leave the room (and hence not # getting a reply). While we're here, check that you can't have more than # one call in flight at a time. -- cgit v1.2.3