[Telepathy-commits] [telepathy-gabble/master] add activity attribute to view/queries reply
Guillaume Desmottes
guillaume.desmottes at collabora.co.uk
Fri Sep 26 10:02:18 PDT 2008
20080609143653-7fe3f-2ee82a1499b214addd7276fcc64c8b86ac40356a.gz
---
src/conn-olpc.c | 22 +++++++++++++++++++++-
tests/twisted/olpc/olpc-activity-search.py | 3 +++
2 files changed, 24 insertions(+), 1 deletions(-)
diff --git a/src/conn-olpc.c b/src/conn-olpc.c
index 70a5f92..7aae880 100644
--- a/src/conn-olpc.c
+++ b/src/conn-olpc.c
@@ -3452,7 +3452,7 @@ activity_query_result_cb (GabbleConnection *conn,
for (activity = view_node->children; activity != NULL;
activity = activity->next)
{
- const gchar *jid;
+ const gchar *jid, *act_id;
LmMessageNode *properties_node;
GHashTable *properties;
TpHandle handle;
@@ -3461,6 +3461,18 @@ activity_query_result_cb (GabbleConnection *conn,
GPtrArray *buddies_properties;
jid = lm_message_node_get_attribute (activity, "room");
+ if (jid == NULL)
+ {
+ NODE_DEBUG (activity, "No room attribute, skipping");
+ continue;
+ }
+
+ act_id = lm_message_node_get_attribute (activity, "activity");
+ if (act_id == NULL)
+ {
+ NODE_DEBUG (activity, "No activity ID, skipping");
+ continue;
+ }
handle = tp_handle_ensure (room_repo, jid, NULL, NULL);
if (handle == 0)
@@ -3493,6 +3505,14 @@ activity_query_result_cb (GabbleConnection *conn,
info->refcount++;
}
+ if (tp_strdiff (info->id, act_id))
+ {
+ DEBUG ("Assigning new ID <%s> to room #%u", act_id, handle);
+
+ g_free (info->id);
+ info->id = g_strdup (act_id);
+ }
+
activity_info_set_properties (info, properties);
buddies = g_array_new (FALSE, FALSE, sizeof (TpHandle));
diff --git a/tests/twisted/olpc/olpc-activity-search.py b/tests/twisted/olpc/olpc-activity-search.py
index 5dea226..6479f88 100644
--- a/tests/twisted/olpc/olpc-activity-search.py
+++ b/tests/twisted/olpc/olpc-activity-search.py
@@ -83,6 +83,7 @@ def test(q, bus, conn, stream):
view = xpath.queryForNodes('/iq/view', reply)[0]
activity = view.addElement((None, "activity"))
activity['room'] = 'room1 at conference.localhost'
+ activity['activity'] = 'activity1'
properties = activity.addElement((NS_OLPC_ACTIVITY_PROPS, "properties"))
property = properties.addElement((None, "property"))
property['type'] = 'str'
@@ -152,6 +153,7 @@ def test(q, bus, conn, stream):
view = xpath.queryForNodes('/iq/view', reply)[0]
activity = view.addElement((None, "activity"))
activity['room'] = 'room2 at conference.localhost'
+ activity['activity'] = 'activity2'
properties = activity.addElement((NS_OLPC_ACTIVITY_PROPS, "properties"))
property = properties.addElement((None, "property"))
property['type'] = 'str'
@@ -198,6 +200,7 @@ def test(q, bus, conn, stream):
view = xpath.queryForNodes('/iq/view', reply)[0]
activity = view.addElement((None, "activity"))
activity['room'] = 'room2 at conference.localhost'
+ activity['activity'] = 'activity2'
properties = activity.addElement((NS_OLPC_ACTIVITY_PROPS, "properties"))
property = properties.addElement((None, "property"))
property['type'] = 'str'
--
1.5.6.5
More information about the Telepathy-commits
mailing list