Skip to content
This repository has been archived by the owner on Jan 10, 2024. It is now read-only.

Commit

Permalink
XEP-0045: Add a helper method to request voice
Browse files Browse the repository at this point in the history
This can be used in a moderated room when we are only a visitor.
  • Loading branch information
linkmauve committed May 21, 2021
1 parent b7f0160 commit 889cfaa
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions slixmpp/plugins/xep_0045/muc.py
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,19 @@ def decline(self, room: JID, jid: JID, reason: str = '', *,
msg['muc']['decline']['reason'] = reason
self.xmpp.send(msg)

def request_voice(self, room: JID, role: str, *, mfrom: Optional[JID] = None):
"""Request voice in a moderated room.
:param room: Room to request voice from.
"""
#form = self.xmpp['xep_0004'].make_form(ftype='submit')
msg = self.xmpp.make_message(room, mfrom=mfrom)
form = msg['form']
form['type'] = 'submit'
form.add_field(var='FORM_TYPE', ftype='hidden', value='http://jabber.org/protocol/muc#request')
form.add_field(var='muc#role', ftype='list-single', label='Requested role', value=role)
self.xmpp.send(msg)

def jid_in_room(self, room: JID, jid: JID) -> bool:
"""Check if a JID is present in a room.
Expand Down

0 comments on commit 889cfaa

Please sign in to comment.