presence: Ensure <show/> value is valid when returned as presence @type value

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
Maxime “pep” Buquet 2019-04-24 20:29:54 +01:00
parent 946674f424
commit 60a7a5b8df
Signed by: pep
GPG key ID: DEDA74AEECA9D0F2

View file

@ -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'