mirror of
https://github.com/correl/SleekXMPP.git
synced 2024-11-27 19:19:54 +00:00
base message and presence events detect xmlns being used
This commit is contained in:
parent
a280e3c140
commit
171bb30e83
1 changed files with 15 additions and 5 deletions
|
@ -343,9 +343,14 @@ class basexmpp(object):
|
||||||
|
|
||||||
def _handleMessage(self, msg):
|
def _handleMessage(self, msg):
|
||||||
xml = msg.xml
|
xml = msg.xml
|
||||||
|
ns = xml.tag.split('}')[0]
|
||||||
|
if ns == 'message':
|
||||||
|
ns = ''
|
||||||
|
else:
|
||||||
|
ns = "%s}" % ns
|
||||||
mfrom = xml.attrib['from']
|
mfrom = xml.attrib['from']
|
||||||
message = xml.find('{%s}body' % self.default_ns).text
|
message = xml.find('%sbody' % ns).text
|
||||||
subject = xml.find('{%s}subject' % self.default_ns)
|
subject = xml.find('%ssubject' % ns)
|
||||||
if subject is not None:
|
if subject is not None:
|
||||||
subject = subject.text
|
subject = subject.text
|
||||||
else:
|
else:
|
||||||
|
@ -358,10 +363,15 @@ class basexmpp(object):
|
||||||
|
|
||||||
def _handlePresence(self, presence):
|
def _handlePresence(self, presence):
|
||||||
xml = presence.xml
|
xml = presence.xml
|
||||||
|
ns = xml.tag.split('}')[0]
|
||||||
|
if ns == 'presence':
|
||||||
|
ns = ''
|
||||||
|
else:
|
||||||
|
ns = "%s}" % ns
|
||||||
"""Update roster items based on presence"""
|
"""Update roster items based on presence"""
|
||||||
show = xml.find('{%s}show' % self.default_ns)
|
show = xml.find('%sshow' % ns)
|
||||||
status = xml.find('{%s}status' % self.default_ns)
|
status = xml.find('%sstatus' % ns)
|
||||||
priority = xml.find('{%s}priority' % self.default_ns)
|
priority = xml.find('%spriority' % ns)
|
||||||
fulljid = xml.attrib['from']
|
fulljid = xml.attrib['from']
|
||||||
to = xml.attrib['to']
|
to = xml.attrib['to']
|
||||||
resource = self.getjidresource(fulljid)
|
resource = self.getjidresource(fulljid)
|
||||||
|
|
Loading…
Reference in a new issue