summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2014-09-09 08:49:37 -0700
committerLance Stout <lancestout@gmail.com>2014-09-09 08:49:37 -0700
commitf22d8e67b402f4756a497d8797e1526c2b7682a1 (patch)
tree9ca67983542c4f146837892fc4a251c125ff8c4d
parentaabec8b993748866b9cf3f09ebb7ae7ce2ddc426 (diff)
downloadslixmpp-f22d8e67b402f4756a497d8797e1526c2b7682a1.tar.gz
slixmpp-f22d8e67b402f4756a497d8797e1526c2b7682a1.tar.bz2
slixmpp-f22d8e67b402f4756a497d8797e1526c2b7682a1.tar.xz
slixmpp-f22d8e67b402f4756a497d8797e1526c2b7682a1.zip
Preserve ID for error responses
Fixes #319
-rw-r--r--sleekxmpp/stanza/rootstanza.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/sleekxmpp/stanza/rootstanza.py b/sleekxmpp/stanza/rootstanza.py
index a7c2b218..52b807e5 100644
--- a/sleekxmpp/stanza/rootstanza.py
+++ b/sleekxmpp/stanza/rootstanza.py
@@ -60,7 +60,9 @@ class RootStanza(StanzaBase):
self.send()
elif isinstance(e, XMPPError):
# We raised this deliberately
+ keep_id = self['id']
self.reply(clear=e.clear)
+ self['id'] = keep_id
self['error']['condition'] = e.condition
self['error']['text'] = e.text
self['error']['type'] = e.etype
@@ -72,7 +74,9 @@ class RootStanza(StanzaBase):
self.send()
else:
# We probably didn't raise this on purpose, so send an error stanza
+ keep_id = self['id']
self.reply()
+ self['id'] = keep_id
self['error']['condition'] = 'undefined-condition'
self['error']['text'] = "SleekXMPP got into trouble."
self['error']['type'] = 'cancel'