diff options
author | Lance Stout <lancestout@gmail.com> | 2012-09-28 11:02:57 -0700 |
---|---|---|
committer | Lance Stout <lancestout@gmail.com> | 2012-09-28 11:02:57 -0700 |
commit | a2c60a4911c64a8b40c39dfb9d74ed0eaed0e9b3 (patch) | |
tree | 40d99fd4b547e4f81e2c9c2b29682c6bb7ac7a06 /sleekxmpp/stanza | |
parent | 73ce9a5eccb5fea6f9a6dd72410cdada2a43347f (diff) | |
parent | ee9c4abd08db06fd6dc808d48c43cd6d57bd1aa1 (diff) | |
download | slixmpp-a2c60a4911c64a8b40c39dfb9d74ed0eaed0e9b3.tar.gz slixmpp-a2c60a4911c64a8b40c39dfb9d74ed0eaed0e9b3.tar.bz2 slixmpp-a2c60a4911c64a8b40c39dfb9d74ed0eaed0e9b3.tar.xz slixmpp-a2c60a4911c64a8b40c39dfb9d74ed0eaed0e9b3.zip |
Merge branch 'master' into develop
Diffstat (limited to 'sleekxmpp/stanza')
-rw-r--r-- | sleekxmpp/stanza/message.py | 11 | ||||
-rw-r--r-- | sleekxmpp/stanza/presence.py | 11 |
2 files changed, 22 insertions, 0 deletions
diff --git a/sleekxmpp/stanza/message.py b/sleekxmpp/stanza/message.py index 02133682..0bb6e587 100644 --- a/sleekxmpp/stanza/message.py +++ b/sleekxmpp/stanza/message.py @@ -63,6 +63,17 @@ class Message(RootStanza): lang_interfaces = sub_interfaces types = set(['normal', 'chat', 'headline', 'error', 'groupchat']) + def __init__(self, *args, **kwargs): + """ + Initialize a new <message /> stanza with an optional 'id' value. + + Overrides StanzaBase.__init__. + """ + StanzaBase.__init__(self, *args, **kwargs) + if self['id'] == '': + if self.stream is not None and self.stream.use_message_ids: + self['id'] = self.stream.new_id() + def get_type(self): """ Return the message type. diff --git a/sleekxmpp/stanza/presence.py b/sleekxmpp/stanza/presence.py index 7951f861..84bcd122 100644 --- a/sleekxmpp/stanza/presence.py +++ b/sleekxmpp/stanza/presence.py @@ -72,6 +72,17 @@ class Presence(RootStanza): 'subscribed', 'unsubscribe', 'unsubscribed']) showtypes = set(['dnd', 'chat', 'xa', 'away']) + def __init__(self, *args, **kwargs): + """ + Initialize a new <presence /> stanza with an optional 'id' value. + + Overrides StanzaBase.__init__. + """ + StanzaBase.__init__(self, *args, **kwargs) + if self['id'] == '': + if self.stream is not None and self.stream.use_presence_ids: + self['id'] = self.stream.new_id() + def exception(self, e): """ Override exception passback for presence. |