core, plugins: fixed bad use of children instead of elements() for domish.Element instances.
This commit is contained in:
parent
58561b8732
commit
eb60e0ff33
1 changed files with 19 additions and 19 deletions
|
|
@ -104,15 +104,15 @@ class XEP_0163(object):
|
|||
debug(_("No item found"))
|
||||
return
|
||||
try:
|
||||
mood_elem = filter(lambda x: x.name == "mood", itemsEvent.items[0].children)[0]
|
||||
except KeyError:
|
||||
mood_elt = [child for child in itemsEvent.items[0].elements() if child.name == "mood"][0]
|
||||
except IndexError:
|
||||
error(_("Can't find mood element in mood event"))
|
||||
return
|
||||
_mood = Mood.fromXml(mood_elem)
|
||||
if not _mood:
|
||||
mood = Mood.fromXml(mood_elt)
|
||||
if not mood:
|
||||
debug(_("No mood found"))
|
||||
return
|
||||
self.host.bridge.personalEvent(itemsEvent.sender.full(), "MOOD", {"mood": _mood.value or "", "text": _mood.text or ""}, profile)
|
||||
self.host.bridge.personalEvent(itemsEvent.sender.full(), "MOOD", {"mood": mood.value or "", "text": mood.text or ""}, profile)
|
||||
|
||||
def sendMood(self, data, profile):
|
||||
"""Send XEP-0107's User Mood
|
||||
|
|
@ -124,8 +124,8 @@ class XEP_0163(object):
|
|||
except KeyError:
|
||||
error(_("Mood data must contain at least 'mood' key"))
|
||||
return 3
|
||||
_mood = UserMood(value, text)
|
||||
self.sendPEPEvent(NS_USER_MOOD, _mood, profile)
|
||||
mood = UserMood(value, text)
|
||||
self.sendPEPEvent(NS_USER_MOOD, mood, profile)
|
||||
return 0
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue