summaryrefslogtreecommitdiff
path: root/sleekxmpp/stanza/error.py
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2012-06-16 14:12:13 -0700
committerLance Stout <lancestout@gmail.com>2012-06-18 22:19:04 -0700
commit8da387a38aa90069cdcb44df2a36ccea303b62c8 (patch)
treea7f67003a229d8c8819838082f93d2beb6271d0a /sleekxmpp/stanza/error.py
parentff6fc44215c07ef112c59dec32ed753cd30a460c (diff)
downloadslixmpp-8da387a38aa90069cdcb44df2a36ccea303b62c8.tar.gz
slixmpp-8da387a38aa90069cdcb44df2a36ccea303b62c8.tar.bz2
slixmpp-8da387a38aa90069cdcb44df2a36ccea303b62c8.tar.xz
slixmpp-8da387a38aa90069cdcb44df2a36ccea303b62c8.zip
Add support for error conditions that include data.
Diffstat (limited to 'sleekxmpp/stanza/error.py')
-rw-r--r--sleekxmpp/stanza/error.py26
1 files changed, 25 insertions, 1 deletions
diff --git a/sleekxmpp/stanza/error.py b/sleekxmpp/stanza/error.py
index 825287ad..35a8913a 100644
--- a/sleekxmpp/stanza/error.py
+++ b/sleekxmpp/stanza/error.py
@@ -51,7 +51,8 @@ class Error(ElementBase):
namespace = 'jabber:client'
name = 'error'
plugin_attrib = 'error'
- interfaces = set(('code', 'condition', 'text', 'type'))
+ interfaces = set(('code', 'condition', 'text', 'type',
+ 'gone', 'redirect'))
sub_interfaces = set(('text',))
plugin_attrib_map = {}
plugin_tag_map = {}
@@ -135,6 +136,29 @@ class Error(ElementBase):
self._del_sub('{%s}text' % self.condition_ns)
return self
+ def get_gone(self):
+ return self._get_sub_text('{%s}gone' % self.condition_ns, '')
+
+ def get_redirect(self):
+ return self._get_sub_text('{%s}redirect' % self.condition_ns, '')
+
+ def set_gone(self, value):
+ del self['condition']
+ if value:
+ return self._set_sub_text('{%s}gone' % self.condition_ns, value)
+
+ def set_redirect(self, value):
+ del self['condition']
+ if value:
+ ns = self.condition_ns
+ return self._set_sub_text('{%s}redirect' % ns, value)
+
+ def del_gone(self):
+ self._del_sub('{%s}gone' % self.condition_ns)
+
+ def del_redirect(self):
+ self._del_sub('{%s}redirect' % self.condition_ns)
+
# To comply with PEP8, method names now use underscores.
# Deprecated method names are re-mapped for backwards compatibility.