core, plugins: fixed bad use of children instead of elements() for domish.Element instances.

This commit is contained in:
Goffi 2013-10-15 19:28:34 +02:00
commit eb60e0ff33

View file

@ -27,7 +27,7 @@ try:
except ImportError:
from wokkel.subprotocols import XMPPHandler
from threading import Timer
from twisted.words.xish.domish import generateElementsNamed
from twisted.words.xish import domish
NS_XMPP_CLIENT = "jabber:client"
NS_CHAT_STATES = "http://jabber.org/protocol/chatstates"
@ -143,10 +143,10 @@ class XEP_0085(object):
return True
try:
generateElementsNamed(message.children, name="body").next()
domish.generateElementsNamed(message.elements(), name="body").next()
from_jid = JID(message.getAttribute("from"))
try:
generateElementsNamed(message.children, name="active").next()
domish.generateElementsNamed(message.elements(), name="active").next()
# contact enabled Chat State Notifications
self.updateEntityData(from_jid, True, profile)
# init to send following "composing" state
@ -158,7 +158,7 @@ class XEP_0085(object):
except StopIteration:
pass
state_list = [child.name for child in message.children if
state_list = [child.name for child in message.elements() if
message.getAttribute("type") in MESSAGE_TYPES
and child.name in CHAT_STATES
and child.defaultUri == NS_CHAT_STATES]
@ -178,7 +178,7 @@ class XEP_0085(object):
return True
try:
# message with a body always mean active state
generateElementsNamed(message.children, name="body").next()
domish.generateElementsNamed(message.elements(), name="body").next()
message.addElement('active', NS_CHAT_STATES)
# launch the chat state machine (init the timer)
self.__chatStateActive(to_jid, mess_data["type"], profile)