From 60df4ef7aa6e17da329777f9dc66f9bc8ebbe901 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxime=20=E2=80=9Cpep=E2=80=9D=20Buquet?= Date: Wed, 16 Mar 2022 16:12:20 +0100 Subject: [PATCH] xep_0045: Require JID when setting outcast affiliation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Found out when reading poezio/poezio#3536. “An admin or owner can ban one or more users from a room. The ban MUST be performed based on the occupant's bare JID.” Signed-off-by: Maxime “pep” Buquet --- slixmpp/plugins/xep_0045/muc.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/slixmpp/plugins/xep_0045/muc.py b/slixmpp/plugins/xep_0045/muc.py index e5971bee..90cb73d7 100644 --- a/slixmpp/plugins/xep_0045/muc.py +++ b/slixmpp/plugins/xep_0045/muc.py @@ -493,6 +493,8 @@ class XEP_0045(BasePlugin): """ if affiliation not in AFFILIATIONS: raise ValueError('%s is not a valid affiliation' % affiliation) + if affiliation == 'outcast' and not jid: + raise ValueError('Outcast affiliation requires a using a jid') if not any((jid, nick)): raise ValueError('One of jid or nick must be set') iq = self.xmpp.make_iq_set(ito=room, ifrom=ifrom)