Add support for error conditions that include data.

This commit is contained in:
Lance Stout
2012-06-16 14:12:13 -07:00
parent ff6fc44215
commit 8da387a38a
2 changed files with 40 additions and 2 deletions

View File

@@ -54,7 +54,7 @@ class StreamError(Error, StanzaBase):
"""
namespace = 'http://etherx.jabber.org/streams'
interfaces = set(('condition', 'text'))
interfaces = set(('condition', 'text', 'see_other_host'))
conditions = set((
'bad-format', 'bad-namespace-prefix', 'conflict',
'connection-timeout', 'host-gone', 'host-unknown',
@@ -66,3 +66,17 @@ class StreamError(Error, StanzaBase):
'unsupported-feature', 'unsupported-stanza-type',
'unsupported-version'))
condition_ns = 'urn:ietf:params:xml:ns:xmpp-streams'
def get_see_other_host(self):
ns = self.condition_ns
return self._get_sub_text('{%s}see-other-host' % ns, '')
def set_see_other_host(self, value):
del self['condition']
if value:
ns = self.condition_ns
return self._set_sub_text('{%s}see-other-host' % ns, value)
def del_see_other_host(self):
self._del_sub('{%s}see-other-host' % self.condition_ns)