[Telepathy-commits] [telepathy-gabble/master] change activities queries to use <view> instead of <query>
Guillaume Desmottes
guillaume.desmottes at collabora.co.uk
Fri Sep 26 10:02:12 PDT 2008
20080523101853-7fe3f-c48df9714bce4b9ac99f7e705ad459f0acf0287d.gz
---
src/conn-olpc.c | 15 ++++++-----
tests/twisted/olpc/olpc-activity-search.py | 36 ++++++++++++++--------------
2 files changed, 26 insertions(+), 25 deletions(-)
diff --git a/src/conn-olpc.c b/src/conn-olpc.c
index 93fe69f..909283b 100644
--- a/src/conn-olpc.c
+++ b/src/conn-olpc.c
@@ -3360,19 +3360,20 @@ activity_query_result_cb (GabbleConnection *conn,
GObject *_view,
gpointer user_data)
{
- LmMessageNode *query, *activity;
+ LmMessageNode *view_node, *activity;
TpHandleSet *activities;
TpHandleRepoIface *room_repo = tp_base_connection_get_handles (
(TpBaseConnection*) conn, TP_HANDLE_TYPE_ROOM);
GabbleOlpcActivityView *view = GABBLE_OLPC_ACTIVITY_VIEW (_view);
- query = lm_message_node_get_child_with_namespace (reply_msg->node, "query",
+ view_node = lm_message_node_get_child_with_namespace (reply_msg->node, "view",
NS_OLPC_ACTIVITY);
- if (query == NULL)
+ if (view_node == NULL)
return LM_HANDLER_RESULT_REMOVE_MESSAGE;
activities = tp_handle_set_new (room_repo);
- for (activity = query->children; activity != NULL; activity = activity->next)
+ for (activity = view_node->children; activity != NULL;
+ activity = activity->next)
{
const gchar *jid;
LmMessageNode *properties_node;
@@ -3491,7 +3492,7 @@ olpc_gadget_request_random_activities (GabbleSvcOLPCGadget *iface,
query = lm_message_build_with_sub_type (conn->olpc_gadget_activity,
LM_MESSAGE_TYPE_IQ, LM_MESSAGE_SUB_TYPE_GET,
- '(', "query", "",
+ '(', "view", "",
'@', "xmlns", NS_OLPC_ACTIVITY,
'@', "id", id_str,
'(', "random", "",
@@ -3559,7 +3560,7 @@ olpc_gadget_search_activities_by_properties (GabbleSvcOLPCGadget *iface,
query = lm_message_build_with_sub_type (conn->olpc_gadget_activity,
LM_MESSAGE_TYPE_IQ, LM_MESSAGE_SUB_TYPE_GET,
- '(', "query", "",
+ '(', "view", "",
'@', "xmlns", NS_OLPC_ACTIVITY,
'@', "id", id_str,
'(', "activity", "",
@@ -3634,7 +3635,7 @@ olpc_gadget_search_activities_by_participants (GabbleSvcOLPCGadget *iface,
query = lm_message_build_with_sub_type (conn->olpc_gadget_activity,
LM_MESSAGE_TYPE_IQ, LM_MESSAGE_SUB_TYPE_GET,
- '(', "query", "",
+ '(', "view", "",
'@', "xmlns", NS_OLPC_ACTIVITY,
'@', "id", id_str,
'(', "activity", "",
diff --git a/tests/twisted/olpc/olpc-activity-search.py b/tests/twisted/olpc/olpc-activity-search.py
index 98d8f95..a91aca9 100644
--- a/tests/twisted/olpc/olpc-activity-search.py
+++ b/tests/twisted/olpc/olpc-activity-search.py
@@ -68,10 +68,10 @@ def test(q, bus, conn, stream):
EventPattern('stream-iq', to='gadget.localhost', query_ns=NS_OLPC_ACTIVITY),
EventPattern('dbus-return', method='RequestRandomActivities'))
- query = iq_event.stanza.firstChildElement()
- assert query.name == 'query'
- assert query['id'] == '0'
- random = xpath.queryForNodes('/iq/query/random', iq_event.stanza)
+ view = iq_event.stanza.firstChildElement()
+ assert view.name == 'view'
+ assert view['id'] == '0'
+ random = xpath.queryForNodes('/iq/view/random', iq_event.stanza)
assert len(random) == 1
assert random[0]['max'] == '3'
@@ -79,8 +79,8 @@ def test(q, bus, conn, stream):
reply = make_result_iq(stream, iq_event.stanza)
reply['from'] = 'gadget.localhost'
reply['to'] = 'alice at localhost'
- query = xpath.queryForNodes('/iq/query', reply)[0]
- activity = query.addElement((None, "activity"))
+ view = xpath.queryForNodes('/iq/view', reply)[0]
+ activity = view.addElement((None, "activity"))
activity['room'] = 'room1 at conference.localhost'
properties = activity.addElement((NS_OLPC_ACTIVITY_PROPS, "properties"))
property = properties.addElement((None, "property"))
@@ -106,10 +106,10 @@ def test(q, bus, conn, stream):
EventPattern('stream-iq', to='gadget.localhost', query_ns=NS_OLPC_ACTIVITY),
EventPattern('dbus-return', method='SearchActivitiesByProperties'))
- properties = xpath.queryForNodes('/iq/query/activity/properties/property', iq_event.stanza)
- query = iq_event.stanza.firstChildElement()
- assert query.name == 'query'
- assert query['id'] == '1'
+ properties = xpath.queryForNodes('/iq/view/activity/properties/property', iq_event.stanza)
+ view = iq_event.stanza.firstChildElement()
+ assert view.name == 'view'
+ assert view['id'] == '1'
assert len(properties) == 1
property = properties[0]
assert property['type'] == 'str'
@@ -120,8 +120,8 @@ def test(q, bus, conn, stream):
reply = make_result_iq(stream, iq_event.stanza)
reply['from'] = 'gadget.localhost'
reply['to'] = 'alice at localhost'
- query = xpath.queryForNodes('/iq/query', reply)[0]
- activity = query.addElement((None, "activity"))
+ view = xpath.queryForNodes('/iq/view', reply)[0]
+ activity = view.addElement((None, "activity"))
activity['room'] = 'room2 at conference.localhost'
properties = activity.addElement((NS_OLPC_ACTIVITY_PROPS, "properties"))
property = properties.addElement((None, "property"))
@@ -147,10 +147,10 @@ def test(q, bus, conn, stream):
EventPattern('stream-iq', to='gadget.localhost', query_ns=NS_OLPC_ACTIVITY),
EventPattern('dbus-return', method='SearchActivitiesByParticipants'))
- buddies = xpath.queryForNodes('/iq/query/activity/buddy', iq_event.stanza)
- query = iq_event.stanza.firstChildElement()
- assert query.name == 'query'
- assert query['id'] == '2'
+ buddies = xpath.queryForNodes('/iq/view/activity/buddy', iq_event.stanza)
+ view = iq_event.stanza.firstChildElement()
+ assert view.name == 'view'
+ assert view['id'] == '2'
assert len(buddies) == 2
assert (buddies[0]['jid'], buddies[1]['jid']) == ('alice at localhost', 'bob at localhost')
@@ -158,8 +158,8 @@ def test(q, bus, conn, stream):
reply = make_result_iq(stream, iq_event.stanza)
reply['from'] = 'gadget.localhost'
reply['to'] = 'alice at localhost'
- query = xpath.queryForNodes('/iq/query', reply)[0]
- activity = query.addElement((None, "activity"))
+ view = xpath.queryForNodes('/iq/view', reply)[0]
+ activity = view.addElement((None, "activity"))
activity['room'] = 'room2 at conference.localhost'
properties = activity.addElement((NS_OLPC_ACTIVITY_PROPS, "properties"))
property = properties.addElement((None, "property"))
--
1.5.6.5
More information about the Telepathy-commits
mailing list