summaryrefslogtreecommitdiff
path: root/sleekxmpp/stanza/message.py
diff options
context:
space:
mode:
authorNathan Fritz <fritzy@netflint.net>2009-12-17 01:54:22 +0000
committerNathan Fritz <fritzy@netflint.net>2009-12-17 01:54:22 +0000
commit07018c0afa7485b06424bf6787d242e7ee523d34 (patch)
tree5de2ae3309eb439b96d4dc5ce62abf00597f75f3 /sleekxmpp/stanza/message.py
parent6897a0b57c299cff9e32fde4dcb4209e70fb4bcb (diff)
downloadslixmpp-07018c0afa7485b06424bf6787d242e7ee523d34.tar.gz
slixmpp-07018c0afa7485b06424bf6787d242e7ee523d34.tar.bz2
slixmpp-07018c0afa7485b06424bf6787d242e7ee523d34.tar.xz
slixmpp-07018c0afa7485b06424bf6787d242e7ee523d34.zip
* fixed many stanza bugs
* added stanza unhandled (unhandled iqs now reply with feature-not-implemented) * added stanza exceptions (stanzas may now reply with exceptions when their handler raises an exception)
Diffstat (limited to 'sleekxmpp/stanza/message.py')
-rw-r--r--sleekxmpp/stanza/message.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/sleekxmpp/stanza/message.py b/sleekxmpp/stanza/message.py
index 999f7924..d75421c8 100644
--- a/sleekxmpp/stanza/message.py
+++ b/sleekxmpp/stanza/message.py
@@ -4,7 +4,7 @@ from . error import Error
class Message(StanzaBase):
interfaces = set(('type', 'to', 'from', 'id', 'body', 'subject'))
- types = set((None, 'normal', 'chat', 'headline', 'error'))
+ types = set((None, 'normal', 'chat', 'headline', 'error', 'groupchat'))
sub_interfaces = set(('body', 'subject'))
name = 'message'
namespace = 'jabber:client'
@@ -22,9 +22,16 @@ class Message(StanzaBase):
def reply(self, body=None):
StanzaBase.reply(self)
+ del self['id']
if body is not None:
self['body'] = body
return self
+ def exception(self, text):
+ self.reply()
+ self['error']['condition'] = 'undefined-condition'
+ self['error']['text'] = text
+ self.send()
+
Message.plugin_attrib_map['error'] = Error
Message.plugin_tag_map["{%s}%s" % (Error.namespace, Error.name)] = Error