xep_0045: Require JID when setting outcast affiliation
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 <pep@bouah.net>
This commit is contained in:
parent
ad610c7ded
commit
60df4ef7aa
@ -493,6 +493,8 @@ class XEP_0045(BasePlugin):
|
|||||||
"""
|
"""
|
||||||
if affiliation not in AFFILIATIONS:
|
if affiliation not in AFFILIATIONS:
|
||||||
raise ValueError('%s is not a valid affiliation' % affiliation)
|
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)):
|
if not any((jid, nick)):
|
||||||
raise ValueError('One of jid or nick must be set')
|
raise ValueError('One of jid or nick must be set')
|
||||||
iq = self.xmpp.make_iq_set(ito=room, ifrom=ifrom)
|
iq = self.xmpp.make_iq_set(ito=room, ifrom=ifrom)
|
||||||
|
Loading…
Reference in New Issue
Block a user