diff options
author | Lance Stout <lancestout@gmail.com> | 2011-01-16 13:22:52 -0500 |
---|---|---|
committer | Lance Stout <lancestout@gmail.com> | 2011-01-16 13:22:52 -0500 |
commit | 2004ddd678fae9af590db2065478d2592bc2530b (patch) | |
tree | 175b9f92ad6d4fbdaa8d87e7da6fd274a7de6538 /sleekxmpp/stanza | |
parent | cb85d4a5297b0eb6cc24052321b38f9f29f62004 (diff) | |
download | slixmpp-2004ddd678fae9af590db2065478d2592bc2530b.tar.gz slixmpp-2004ddd678fae9af590db2065478d2592bc2530b.tar.bz2 slixmpp-2004ddd678fae9af590db2065478d2592bc2530b.tar.xz slixmpp-2004ddd678fae9af590db2065478d2592bc2530b.zip |
Add StreamError stanza and a stream_error event.
Note that the stream may automatically attempt to
reconnect when a stream error is received.
Diffstat (limited to 'sleekxmpp/stanza')
-rw-r--r-- | sleekxmpp/stanza/__init__.py | 1 | ||||
-rw-r--r-- | sleekxmpp/stanza/iq.py | 1 | ||||
-rw-r--r-- | sleekxmpp/stanza/stream_error.py | 59 |
3 files changed, 60 insertions, 1 deletions
diff --git a/sleekxmpp/stanza/__init__.py b/sleekxmpp/stanza/__init__.py index 8302c43d..dbf7b86f 100644 --- a/sleekxmpp/stanza/__init__.py +++ b/sleekxmpp/stanza/__init__.py @@ -8,6 +8,7 @@ from sleekxmpp.stanza.error import Error +from sleekxmpp.stanza.stream_error import StreamError from sleekxmpp.stanza.iq import Iq from sleekxmpp.stanza.message import Message from sleekxmpp.stanza.presence import Presence diff --git a/sleekxmpp/stanza/iq.py b/sleekxmpp/stanza/iq.py index 6388346c..c6aa64d0 100644 --- a/sleekxmpp/stanza/iq.py +++ b/sleekxmpp/stanza/iq.py @@ -224,4 +224,3 @@ class Iq(RootStanza): else: StanzaBase._set_stanza_values(self, values) return self - diff --git a/sleekxmpp/stanza/stream_error.py b/sleekxmpp/stanza/stream_error.py new file mode 100644 index 00000000..dd0c119d --- /dev/null +++ b/sleekxmpp/stanza/stream_error.py @@ -0,0 +1,59 @@ +""" + SleekXMPP: The Sleek XMPP Library + Copyright (C) 2010 Nathanael C. Fritz + This file is part of SleekXMPP. + + See the file LICENSE for copying permission. +""" + +from sleekxmpp.stanza.error import Error +from sleekxmpp.xmlstream import ElementBase, ET, register_stanza_plugin + + +class StreamError(Error): + + """ + XMPP stanzas of type 'error' should include an <error> stanza that + describes the nature of the error and how it should be handled. + + Use the 'XEP-0086: Error Condition Mappings' plugin to include error + codes used in older XMPP versions. + + The stream:error stanza is used to provide more information for + error that occur with the underlying XML stream itself, and not + a particular stanza. + + Note: The StreamError stanza is the same as the normal Error stanza, + but with a different namespace. + + Example error stanza: + <error type="cancel" code="404"> + <item-not-found xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" /> + <text xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"> + The item was not found. + </text> + </error> + + Stanza Interface: + code -- The error code used in older XMPP versions. + condition -- The name of the condition element. + text -- Human readable description of the error. + type -- Error type indicating how the error should be handled. + + Attributes: + conditions -- The set of allowable error condition elements. + condition_ns -- The namespace for the condition element. + types -- A set of values indicating how the error + should be treated. + + Methods: + setup -- Overrides ElementBase.setup. + get_condition -- Retrieve the name of the condition element. + set_condition -- Add a condition element. + del_condition -- Remove the condition element. + get_text -- Retrieve the contents of the <text> element. + set_text -- Set the contents of the <text> element. + del_text -- Remove the <text> element. + """ + + namespace = 'http://etherx.jabber.org/streams' |