summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Fritz <fritzy@netflint.net>2009-07-11 20:47:03 +0000
committerNathan Fritz <fritzy@netflint.net>2009-07-11 20:47:03 +0000
commit171bb30e83b54d9e93c7f5a9834050a02d2ecf70 (patch)
tree50921dcef5b9ccb00cbea254677de06e21145e49
parenta280e3c1405f55dfd372337f5d377212ed717833 (diff)
downloadslixmpp-171bb30e83b54d9e93c7f5a9834050a02d2ecf70.tar.gz
slixmpp-171bb30e83b54d9e93c7f5a9834050a02d2ecf70.tar.bz2
slixmpp-171bb30e83b54d9e93c7f5a9834050a02d2ecf70.tar.xz
slixmpp-171bb30e83b54d9e93c7f5a9834050a02d2ecf70.zip
base message and presence events detect xmlns being used
-rw-r--r--sleekxmpp/basexmpp.py20
1 files changed, 15 insertions, 5 deletions
diff --git a/sleekxmpp/basexmpp.py b/sleekxmpp/basexmpp.py
index 0b819c7a..87b60496 100644
--- a/sleekxmpp/basexmpp.py
+++ b/sleekxmpp/basexmpp.py
@@ -343,9 +343,14 @@ class basexmpp(object):
def _handleMessage(self, msg):
xml = msg.xml
+ ns = xml.tag.split('}')[0]
+ if ns == 'message':
+ ns = ''
+ else:
+ ns = "%s}" % ns
mfrom = xml.attrib['from']
- message = xml.find('{%s}body' % self.default_ns).text
- subject = xml.find('{%s}subject' % self.default_ns)
+ message = xml.find('%sbody' % ns).text
+ subject = xml.find('%ssubject' % ns)
if subject is not None:
subject = subject.text
else:
@@ -358,10 +363,15 @@ class basexmpp(object):
def _handlePresence(self, presence):
xml = presence.xml
+ ns = xml.tag.split('}')[0]
+ if ns == 'presence':
+ ns = ''
+ else:
+ ns = "%s}" % ns
"""Update roster items based on presence"""
- show = xml.find('{%s}show' % self.default_ns)
- status = xml.find('{%s}status' % self.default_ns)
- priority = xml.find('{%s}priority' % self.default_ns)
+ show = xml.find('%sshow' % ns)
+ status = xml.find('%sstatus' % ns)
+ priority = xml.find('%spriority' % ns)
fulljid = xml.attrib['from']
to = xml.attrib['to']
resource = self.getjidresource(fulljid)