summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxime “pep” Buquet <pep@bouah.net>2019-04-24 20:29:54 +0100
committerMaxime “pep” Buquet <pep@bouah.net>2019-04-24 20:29:54 +0100
commit60a7a5b8df7358e5c1f7ac99d432c6b0ce2e7be6 (patch)
treed942b6c0d6ef6ee225d3a63b3e7c12c125e63611
parent946674f424776ebfd1c3b9df6519de44186487cb (diff)
downloadslixmpp-60a7a5b8df7358e5c1f7ac99d432c6b0ce2e7be6.tar.gz
slixmpp-60a7a5b8df7358e5c1f7ac99d432c6b0ce2e7be6.tar.bz2
slixmpp-60a7a5b8df7358e5c1f7ac99d432c6b0ce2e7be6.tar.xz
slixmpp-60a7a5b8df7358e5c1f7ac99d432c6b0ce2e7be6.zip
presence: Ensure <show/> value is valid when returned as presence @type value
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
-rw-r--r--slixmpp/stanza/presence.py4
1 files 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 <presence> stanza's type attribute, or
- the value of the <show> element.
+ the value of the <show> 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'