summaryrefslogtreecommitdiff
path: root/sleekxmpp/stanza/presence.py
diff options
context:
space:
mode:
Diffstat (limited to 'sleekxmpp/stanza/presence.py')
-rw-r--r--sleekxmpp/stanza/presence.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/sleekxmpp/stanza/presence.py b/sleekxmpp/stanza/presence.py
index f591211b..cb6bd6ce 100644
--- a/sleekxmpp/stanza/presence.py
+++ b/sleekxmpp/stanza/presence.py
@@ -19,6 +19,8 @@ class Presence(StanzaBase):
if value in self.types:
if show is not None:
self.xml.remove(show)
+ if value == 'available':
+ value = ''
self._setAttr('type', value)
elif value in self.showtypes:
if show is None:
@@ -44,8 +46,18 @@ class Presence(StanzaBase):
out = 'available'
return out
- def delType(self):
- self.setType('available')
+ def reply(self):
+ if self['type'] == 'unsubscribe':
+ self['type'] = 'unsubscribed'
+ elif self['type'] == 'subscribe':
+ self['type'] = 'subscribed'
+ return StanzaBase.reply(self)
+
+ def exception(self, text):
+ self.reply()
+ self['error']['condition'] = 'undefined-condition'
+ self['error']['text'] = text
+ self.send()
Presence.plugin_attrib_map['error'] = Error
Presence.plugin_tag_map["{%s}%s" % (Error.namespace, Error.name)] = Error