[Telepathy-commits] [telepathy-gabble/master] view-presence: use elem() in send_presence

Guillaume Desmottes guillaume.desmottes at collabora.co.uk
Thu Oct 16 10:00:40 PDT 2008


---
 tests/twisted/olpc/view-presence.py |   17 ++++++++++-------
 1 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/tests/twisted/olpc/view-presence.py b/tests/twisted/olpc/view-presence.py
index d7b7070..4b68a5b 100644
--- a/tests/twisted/olpc/view-presence.py
+++ b/tests/twisted/olpc/view-presence.py
@@ -11,7 +11,7 @@ from twisted.words.xish import domish, xpath
 from twisted.words.protocols.jabber.client import IQ
 
 from util import (announce_gadget, properties_to_xml, parse_properties,
-    create_gadget_message, close_view)
+    create_gadget_message, close_view, elem)
 
 NS_OLPC_BUDDY_PROPS = "http://laptop.org/xmpp/buddy-properties"
 NS_OLPC_ACTIVITIES = "http://laptop.org/xmpp/activities"
@@ -30,12 +30,15 @@ tp_name_prefix = 'org.freedesktop.Telepathy'
 olpc_name_prefix = 'org.laptop.Telepathy'
 
 def send_presence(stream, from_, type, msg):
-    presence = domish.Element((None, 'presence'))
-    presence['from'] = from_
-    show = presence.addElement((None, 'show'))
-    show.addContent(type)
-    status = presence.addElement((None, 'status'))
-    status.addContent(msg)
+    #presence = domish.Element((None, 'presence'))
+    #presence['from'] = from_
+    #show = presence.addElement((None, 'show'))
+    #show.addContent(type)
+    #status = presence.addElement((None, 'status'))
+    #status.addContent(msg)
+    presence = elem('presence', from_=from_)(
+        elem('show')(unicode(type)),
+        elem('status')(unicode(msg)))
     stream.send(presence)
 
 def remove_buddy_from_view(stream, id, jid):
-- 
1.5.6.5




More information about the Telepathy-commits mailing list