diff src/plugins/plugin_xep_0085.py @ 660:69a8bfd266a5

core, plugins: fixed bad use of children instead of elements() for domish.Element instances.
author Goffi <goffi@goffi.org>
date Tue, 15 Oct 2013 19:28:34 +0200
parents b6c22d9f593a
children 4f747d7fde8c
line wrap: on
line diff
--- a/src/plugins/plugin_xep_0085.py	Mon Oct 07 13:09:57 2013 +0200
+++ b/src/plugins/plugin_xep_0085.py	Tue Oct 15 19:28:34 2013 +0200
@@ -27,7 +27,7 @@
 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 @@
             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 @@
         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 @@
             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)