diff options
author | Link Mauve <linkmauve@linkmauve.fr> | 2021-07-17 00:33:15 +0200 |
---|---|---|
committer | Link Mauve <linkmauve@linkmauve.fr> | 2021-07-17 00:33:15 +0200 |
commit | d4067275ff0eb646afaac2b0cbc9f351349ba9c0 (patch) | |
tree | d13a9df3781f35190334af31cbcd671943b4d0af | |
parent | 22fa8bc4d91d38a1176b09d03e0d41313b1adcaa (diff) | |
parent | 91d32bd0660d83a9f23606840d943f05405385a7 (diff) | |
download | slixmpp-d4067275ff0eb646afaac2b0cbc9f351349ba9c0.tar.gz slixmpp-d4067275ff0eb646afaac2b0cbc9f351349ba9c0.tar.bz2 slixmpp-d4067275ff0eb646afaac2b0cbc9f351349ba9c0.tar.xz slixmpp-d4067275ff0eb646afaac2b0cbc9f351349ba9c0.zip |
Merge branch '0045-invite-JID' into 'master'
xep_0045: Ensure invite and decline to/from are JIDs
See merge request poezio/slixmpp!167
-rw-r--r-- | slixmpp/plugins/xep_0045/stanza.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/slixmpp/plugins/xep_0045/stanza.py b/slixmpp/plugins/xep_0045/stanza.py index 71eb3fb5..428dbce7 100644 --- a/slixmpp/plugins/xep_0045/stanza.py +++ b/slixmpp/plugins/xep_0045/stanza.py @@ -179,6 +179,21 @@ class MUCInvite(ElementBase): interfaces = {'to', 'from', '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): name = 'decline' @@ -187,6 +202,22 @@ class MUCDecline(ElementBase): interfaces = {'to', 'from', '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): name = 'history' |