xep_0048: Ensure Conference jid is of type str when given a JID

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
Maxime “pep” Buquet 2019-11-11 14:00:19 +01:00
parent 0139fb291e
commit 9b3874b5df
Signed by: pep
GPG key ID: DEDA74AEECA9D0F2

View file

@ -6,6 +6,7 @@
See the file LICENSE for copying permission. See the file LICENSE for copying permission.
""" """
from slixmpp import JID
from slixmpp.xmlstream import ET, ElementBase, register_stanza_plugin from slixmpp.xmlstream import ET, ElementBase, register_stanza_plugin
@ -52,6 +53,12 @@ class Conference(ElementBase):
if value in ('1', 'true', True): if value in ('1', 'true', True):
self._set_attr('autojoin', 'true') self._set_attr('autojoin', 'true')
def set_jid(self, value):
del self['jid']
if isinstance(value, JID):
value = value.full
self._set_attr('jid', value)
class URL(ElementBase): class URL(ElementBase):
name = 'url' name = 'url'