summaryrefslogtreecommitdiff
path: root/sleekxmpp/stanza/presence.py
diff options
context:
space:
mode:
authorNathan Fritz <fritzy@netflint.net>2009-12-17 01:54:22 +0000
committerNathan Fritz <fritzy@netflint.net>2009-12-17 01:54:22 +0000
commit07018c0afa7485b06424bf6787d242e7ee523d34 (patch)
tree5de2ae3309eb439b96d4dc5ce62abf00597f75f3 /sleekxmpp/stanza/presence.py
parent6897a0b57c299cff9e32fde4dcb4209e70fb4bcb (diff)
downloadslixmpp-07018c0afa7485b06424bf6787d242e7ee523d34.tar.gz
slixmpp-07018c0afa7485b06424bf6787d242e7ee523d34.tar.bz2
slixmpp-07018c0afa7485b06424bf6787d242e7ee523d34.tar.xz
slixmpp-07018c0afa7485b06424bf6787d242e7ee523d34.zip
* fixed many stanza bugs
* added stanza unhandled (unhandled iqs now reply with feature-not-implemented) * added stanza exceptions (stanzas may now reply with exceptions when their handler raises an exception)
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