From 60a7a5b8df7358e5c1f7ac99d432c6b0ce2e7be6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxime=20=E2=80=9Cpep=E2=80=9D=20Buquet?= Date: Wed, 24 Apr 2019 20:29:54 +0100 Subject: [PATCH] presence: Ensure value is valid when returned as presence @type value MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Maxime “pep” Buquet --- slixmpp/stanza/presence.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/slixmpp/stanza/presence.py b/slixmpp/stanza/presence.py index 614cd331..7e59e1c5 100644 --- a/slixmpp/stanza/presence.py +++ b/slixmpp/stanza/presence.py @@ -90,10 +90,10 @@ class Presence(RootStanza): def get_type(self): """ Return the value of the stanza's type attribute, or - the value of the element. + the value of the element if valid. """ out = self._get_attr('type') - if not out: + if not out and self['show'] in self.showtypes: out = self['show'] if not out or out is None: out = 'available'