Use some of the new xep_0045 methods from slixmpp 1.6.0

This commit is contained in:
Emmanuel Gil Peyrot 2020-12-12 18:10:10 +01:00
parent c14a08d708
commit b3ed6cf44d
2 changed files with 2 additions and 23 deletions

View file

@ -240,24 +240,3 @@ def set_user_affiliation(
iq = xmpp.make_iq_set(query)
iq['to'] = muc_jid
iq.send(callback=callback)
def cancel_config(xmpp: ClientXMPP, room: str) -> None:
query = ET.Element('{http://jabber.org/protocol/muc#owner}query')
x = ET.Element('{jabber:x:data}x', type='cancel')
query.append(x)
iq = xmpp.make_iq_set(query)
iq['to'] = room
iq.send()
def configure_room(xmpp: ClientXMPP, room: str, form: 'Form') -> None:
if form is None:
return
iq = xmpp.make_iq_set()
iq['to'] = room
query = ET.Element('{http://jabber.org/protocol/muc#owner}query')
form['type'] = 'submit'
query.append(form.xml)
iq.append(query)
iq.send()

View file

@ -153,14 +153,14 @@ class MucTab(ChatTab):
"""
The user do not want to send their config, send an iq cancel
"""
muc.cancel_config(self.core.xmpp, self.jid.bare)
asyncio.ensure_future(self.core.xmpp['xep_0045'].cancel_config(self.jid.bare))
self.core.close_tab()
def send_config(self, form: 'Form') -> None:
"""
The user sends their config to the server
"""
muc.configure_room(self.core.xmpp, self.jid.bare, form)
asyncio.ensure_future(self.core.xmpp['xep_0045'].set_room_config(self.jid.bare, form))
self.core.close_tab()
def join(self) -> None: