summaryrefslogtreecommitdiff
path: root/sleekxmpp/basexmpp.py
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2012-04-26 15:46:18 -0700
committerLance Stout <lancestout@gmail.com>2012-04-26 15:46:18 -0700
commit8b4715978802b94088c4440a87b9c86849cfd9cb (patch)
treeec0ebb7e17db02db613d5bb345c9e574ae054536 /sleekxmpp/basexmpp.py
parent2eeaf4d80c7c0cef17701914382911665d6fb621 (diff)
downloadslixmpp-8b4715978802b94088c4440a87b9c86849cfd9cb.tar.gz
slixmpp-8b4715978802b94088c4440a87b9c86849cfd9cb.tar.bz2
slixmpp-8b4715978802b94088c4440a87b9c86849cfd9cb.tar.xz
slixmpp-8b4715978802b94088c4440a87b9c86849cfd9cb.zip
Populate the to attribute for message and presence stanzas if the server leaves it blank.
Diffstat (limited to 'sleekxmpp/basexmpp.py')
-rw-r--r--sleekxmpp/basexmpp.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/sleekxmpp/basexmpp.py b/sleekxmpp/basexmpp.py
index 5fcfbf6d..1c835460 100644
--- a/sleekxmpp/basexmpp.py
+++ b/sleekxmpp/basexmpp.py
@@ -666,19 +666,17 @@ class BaseXMPP(XMLStream):
def _handle_message(self, msg):
"""Process incoming message stanzas."""
+ if not self.is_component and not msg['to'].bare:
+ msg['to'] = self.boundjid
self.event('message', msg)
def _handle_available(self, presence):
pto = presence['to'].bare
- if not pto:
- pto = self.boundjid.bare
pfrom = presence['from'].bare
self.roster[pto][pfrom].handle_available(presence)
def _handle_unavailable(self, presence):
pto = presence['to'].bare
- if not pto:
- pto = self.boundjid.bare
pfrom = presence['from'].bare
self.roster[pto][pfrom].handle_unavailable(presence)
@@ -735,6 +733,9 @@ class BaseXMPP(XMLStream):
Update the roster with presence information.
"""
+ if not self.is_component and not presence['to'].bare:
+ presence['to'] = self.boundjid
+
self.event("presence_%s" % presence['type'], presence)
# Check for changes in subscription state.