summaryrefslogtreecommitdiff
path: root/sleekxmpp/stanza/error.py
diff options
context:
space:
mode:
Diffstat (limited to 'sleekxmpp/stanza/error.py')
-rw-r--r--sleekxmpp/stanza/error.py34
1 files changed, 31 insertions, 3 deletions
diff --git a/sleekxmpp/stanza/error.py b/sleekxmpp/stanza/error.py
index 825287ad..60bc65bc 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 = {}
@@ -88,7 +89,7 @@ class Error(ElementBase):
def get_condition(self):
"""Return the condition element's name."""
- for child in self.xml.getchildren():
+ for child in self.xml:
if "{%s}" % self.condition_ns in child.tag:
cond = child.tag.split('}', 1)[-1]
if cond in self.conditions:
@@ -109,7 +110,7 @@ class Error(ElementBase):
def del_condition(self):
"""Remove the condition element."""
- for child in self.xml.getchildren():
+ for child in self.xml:
if "{%s}" % self.condition_ns in child.tag:
tag = child.tag.split('}', 1)[-1]
if tag in self.conditions:
@@ -135,6 +136,33 @@ 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):
+ if value:
+ del self['condition']
+ return self._set_sub_text('{%s}gone' % self.condition_ns, value)
+ elif self['condition'] == 'gone':
+ del self['condition']
+
+ def set_redirect(self, value):
+ if value:
+ del self['condition']
+ ns = self.condition_ns
+ return self._set_sub_text('{%s}redirect' % ns, value)
+ elif self['condition'] == 'redirect':
+ del self['condition']
+
+ 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.