Merge branch '0045-invite-JID' into 'master'
xep_0045: Ensure invite and decline to/from are JIDs See merge request poezio/slixmpp!167
This commit is contained in:
commit
d4067275ff
1 changed files with 31 additions and 0 deletions
|
@ -179,6 +179,21 @@ class MUCInvite(ElementBase):
|
||||||
interfaces = {'to', 'from', 'reason'}
|
interfaces = {'to', 'from', 'reason'}
|
||||||
sub_interfaces = {'reason'}
|
sub_interfaces = {'reason'}
|
||||||
|
|
||||||
|
def get_to(self) -> JID:
|
||||||
|
return JID(self._get_attr('to'))
|
||||||
|
|
||||||
|
def set_to(self, value: Union[JID, str]):
|
||||||
|
if not isinstance(value, JID):
|
||||||
|
value = JID(value)
|
||||||
|
self._set_attr('to', value)
|
||||||
|
|
||||||
|
def get_from(self) -> JID:
|
||||||
|
return JID(self._get_attr('from'))
|
||||||
|
|
||||||
|
def set_from(self, value: Union[JID, str]):
|
||||||
|
if not isinstance(value, JID):
|
||||||
|
value = JID(value)
|
||||||
|
self._set_attr('from', value)
|
||||||
|
|
||||||
class MUCDecline(ElementBase):
|
class MUCDecline(ElementBase):
|
||||||
name = 'decline'
|
name = 'decline'
|
||||||
|
@ -187,6 +202,22 @@ class MUCDecline(ElementBase):
|
||||||
interfaces = {'to', 'from', 'reason'}
|
interfaces = {'to', 'from', 'reason'}
|
||||||
sub_interfaces = {'reason'}
|
sub_interfaces = {'reason'}
|
||||||
|
|
||||||
|
def get_to(self) -> JID:
|
||||||
|
return JID(self._get_attr('to'))
|
||||||
|
|
||||||
|
def set_to(self, value: Union[JID, str]):
|
||||||
|
if not isinstance(value, JID):
|
||||||
|
value = JID(value)
|
||||||
|
self._set_attr('to', value)
|
||||||
|
|
||||||
|
def get_from(self) -> JID:
|
||||||
|
return JID(self._get_attr('from'))
|
||||||
|
|
||||||
|
def set_from(self, value: Union[JID, str]):
|
||||||
|
if not isinstance(value, JID):
|
||||||
|
value = JID(value)
|
||||||
|
self._set_attr('from', value)
|
||||||
|
|
||||||
|
|
||||||
class MUCHistory(ElementBase):
|
class MUCHistory(ElementBase):
|
||||||
name = 'history'
|
name = 'history'
|
||||||
|
|
Loading…
Reference in a new issue