summaryrefslogtreecommitdiff
path: root/sleekxmpp/stanza
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2011-02-02 09:13:22 -0500
committerLance Stout <lancestout@gmail.com>2011-02-02 09:13:22 -0500
commitde6170a13de2dbb3cbcfbf4a74b749f20b0cf061 (patch)
treeb60043234119a3d215e0eca65913dd038167b551 /sleekxmpp/stanza
parent65931bb384aada922c5287a3ad3cc62d04d6e676 (diff)
parent8dbe6f65462ec9b1a0506a00316415996f4d53d8 (diff)
downloadslixmpp-de6170a13de2dbb3cbcfbf4a74b749f20b0cf061.tar.gz
slixmpp-de6170a13de2dbb3cbcfbf4a74b749f20b0cf061.tar.bz2
slixmpp-de6170a13de2dbb3cbcfbf4a74b749f20b0cf061.tar.xz
slixmpp-de6170a13de2dbb3cbcfbf4a74b749f20b0cf061.zip
Merge branch 'develop' into roster
Conflicts: sleekxmpp/basexmpp.py
Diffstat (limited to 'sleekxmpp/stanza')
-rw-r--r--sleekxmpp/stanza/__init__.py1
-rw-r--r--sleekxmpp/stanza/iq.py1
-rw-r--r--sleekxmpp/stanza/nick.py2
-rw-r--r--sleekxmpp/stanza/stream_error.py69
4 files changed, 71 insertions, 2 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/nick.py b/sleekxmpp/stanza/nick.py
index a9243d1a..dce41d14 100644
--- a/sleekxmpp/stanza/nick.py
+++ b/sleekxmpp/stanza/nick.py
@@ -44,7 +44,7 @@ class Nick(ElementBase):
del_nick -- Remove the <nick> element.
"""
- namespace = 'http://jabber.org/nick/nick'
+ namespace = 'http://jabber.org/protocol/nick'
name = 'nick'
plugin_attrib = name
interfaces = set(('nick',))
diff --git a/sleekxmpp/stanza/stream_error.py b/sleekxmpp/stanza/stream_error.py
new file mode 100644
index 00000000..cf59a7fa
--- /dev/null
+++ b/sleekxmpp/stanza/stream_error.py
@@ -0,0 +1,69 @@
+"""
+ 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 StanzaBase, ElementBase, ET
+from sleekxmpp.xmlstream import register_stanza_plugin
+
+
+class StreamError(Error, StanzaBase):
+
+ """
+ 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 mostly the same as the normal
+ Error stanza, but with different namespaces and
+ condition names.
+
+ Example error stanza:
+ <stream:error>
+ <not-well-formed xmlns="urn:ietf:params:xml:ns:xmpp-streams" />
+ <text xmlns="urn:ietf:params:xml:ns:xmpp-streams">
+ XML was not well-formed.
+ </text>
+ </stream:error>
+
+ Stanza Interface:
+ condition -- The name of the condition element.
+ text -- Human readable description of the error.
+
+ Attributes:
+ conditions -- The set of allowable error condition elements.
+ condition_ns -- The namespace for the condition element.
+
+ 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'
+ interfaces = set(('condition', 'text'))
+ conditions = set((
+ 'bad-format', 'bad-namespace-prefix', 'conflict',
+ 'connection-timeout', 'host-gone', 'host-unknown',
+ 'improper-addressing', 'internal-server-error', 'invalid-from',
+ 'invalid-namespace', 'invalid-xml', 'not-authorized',
+ 'not-well-formed', 'policy-violation', 'remote-connection-failed',
+ 'reset', 'resource-constraint', 'restricted-xml', 'see-other-host',
+ 'system-shutdown', 'undefined-condition', 'unsupported-encoding',
+ 'unsupported-feature', 'unsupported-stanza-type',
+ 'unsupported-version'))
+ condition_ns = 'urn:ietf:params:xml:ns:xmpp-streams'