[Telepathy-commits] [telepathy-gabble/master] merge org.laptop.Telepathy.Buddy and org.laptop.Telepathy.Activity to org.laptop.Telepathy.Gadget

Guillaume Desmottes guillaume.desmottes at collabora.co.uk
Fri Sep 26 10:02:12 PDT 2008


20080523090226-7fe3f-b0a499bf081ae3e8e72be9d31f7fe88e56e076b2.gz
---
 extensions/OLPC_Activity.xml               |   92 ----------------------------
 extensions/OLPC_Buddy.xml                  |   71 ---------------------
 extensions/all.xml                         |    3 +-
 src/conn-olpc.c                            |   79 +++++++++++-------------
 src/conn-olpc.h                            |    4 +-
 src/connection.c                           |   10 +--
 tests/twisted/olpc/olpc-activity-search.py |   14 ++--
 tests/twisted/olpc/olpc-buddy-search.py    |   10 ++--
 8 files changed, 54 insertions(+), 229 deletions(-)
 delete mode 100644 extensions/OLPC_Activity.xml
 delete mode 100644 extensions/OLPC_Buddy.xml

diff --git a/extensions/OLPC_Activity.xml b/extensions/OLPC_Activity.xml
deleted file mode 100644
index 7a5d6f1..0000000
--- a/extensions/OLPC_Activity.xml
+++ /dev/null
@@ -1,92 +0,0 @@
-<?xml version="1.0" ?>
-<node name="/OLPC_Activity" xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0">
-  <tp:copyright> Copyright (C) 2008 Collabora Limited </tp:copyright>
-  <tp:license xmlns="http://www.w3.org/1999/xhtml">
-    <p>This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.</p>
-
-<p>This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-Lesser General Public License for more details.</p>
-
-<p>You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA</p>
-  </tp:license>
-  <interface name="org.laptop.Telepathy.Activity">
-    <tp:requires interface="org.freedesktop.Telepathy.Connection"/>
-    <tp:requires interface="org.laptop.Telepathy.ActivityProperties"/>
-
-    <method name="SearchByProperties">
-      <arg direction="in" name="properties" type="a{sv}">
-        <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
-          An activity properties dictionary as described on
-          <code>org.laptop.Telepathy.ActivityProperties</code>.
-        </tp:docstring>
-      </arg>
-      <arg direction="out" name="view" type="o">
-        <tp:docstring>
-          The D-Bus object path for the view created 
-        </tp:docstring>
-      </arg>
-      <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
-        <p>Search for activities having the given properties.</p>
-        <p>Returns a <code>org.laptop.Telepathy.ActivityView</code> object representing the
-           result of the search.</p>
-      </tp:docstring>
-      <tp:possible-errors>
-        <tp:error name="org.freedesktop.Telepathy.Error.InvalidArgument"/>
-      </tp:possible-errors>
-    </method>
-
-    <method name="RequestRandom">
-      <arg direction="in" name="max" type="u">
-         <tp:docstring>
-          The maximum of random activities to look for.
-        </tp:docstring>
-      </arg>
-      <arg direction="out" name="view" type="o">
-        <tp:docstring>
-          The D-Bus object path for the view created 
-        </tp:docstring>
-      </arg>
-      <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
-        <p>Request random activities.</p>
-        <p>Returns a <code>org.laptop.Telepathy.ActivityView</code> object representing the
-           random activities returned.</p>
-      </tp:docstring>
-      <tp:possible-errors>
-        <tp:error name="org.freedesktop.Telepathy.Error.InvalidArgument"/>
-      </tp:possible-errors>
-    </method>
-
-    <method name="SearchByParticipants">
-      <arg direction="in" name="participants" type="au">
-         <tp:docstring>
-          The handles of the participants
-        </tp:docstring>
-      </arg>
-      <arg direction="out" name="view" type="o">
-        <tp:docstring>
-          The D-Bus object path for the view created 
-        </tp:docstring>
-      </arg>
-      <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
-        <p>Search for activities having the given participants.</p>
-        <p>Returns a <code>org.laptop.Telepathy.ActivityView</code> object representing the
-           result of the search.</p>
-      </tp:docstring>
-      <tp:possible-errors>
-        <tp:error name="org.freedesktop.Telepathy.Error.InvalidArgument"/>
-      </tp:possible-errors>
-    </method>
-
-    <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
-      <p>An interface on connections to search and request activities</p>
-    </tp:docstring>
-  </interface>
-</node>
-<!-- vim:set sw=2 sts=2 et ft=xml: -->
diff --git a/extensions/OLPC_Buddy.xml b/extensions/OLPC_Buddy.xml
deleted file mode 100644
index 660187d..0000000
--- a/extensions/OLPC_Buddy.xml
+++ /dev/null
@@ -1,71 +0,0 @@
-<?xml version="1.0" ?>
-<node name="/OLPC_Buddy" xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0">
-  <tp:copyright> Copyright (C) 2008 Collabora Limited </tp:copyright>
-  <tp:license xmlns="http://www.w3.org/1999/xhtml">
-    <p>This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.</p>
-
-<p>This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-Lesser General Public License for more details.</p>
-
-<p>You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA</p>
-  </tp:license>
-  <interface name="org.laptop.Telepathy.Buddy">
-    <tp:requires interface="org.freedesktop.Telepathy.Connection"/>
-    <tp:requires interface="org.laptop.Telepathy.BuddyInfo"/>
-
-    <method name="SearchByProperties">
-      <arg direction="in" name="properties" type="a{sv}">
-        <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
-          A buddy properties dictionary as described on
-          <code>org.laptop.Telepathy.BuddyInfo</code>.
-        </tp:docstring>
-      </arg>
-      <arg direction="out" name="view" type="o">
-        <tp:docstring>
-          The D-Bus object path for the view created 
-        </tp:docstring>
-      </arg>
-      <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
-        <p>Search for buddies having the given properties.</p>
-        <p>Returns a <code>org.laptop.Telepathy.BuddyView</code> object representing the
-           result of the search.</p>
-      </tp:docstring>
-      <tp:possible-errors>
-        <tp:error name="org.freedesktop.Telepathy.Error.InvalidArgument"/>
-      </tp:possible-errors>
-    </method>
-
-    <method name="RequestRandom">
-      <arg direction="in" name="max" type="u">
-         <tp:docstring>
-          The maximum of random buddies to look for.
-        </tp:docstring>
-      </arg>
-      <arg direction="out" name="view" type="o">
-        <tp:docstring>
-          The D-Bus object path for the view created 
-        </tp:docstring>
-      </arg>
-      <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
-        <p>Request random buddies.</p>
-        <p>Returns a <code>org.laptop.Telepathy.BuddyView</code> object representing the
-           random buddies returned.</p>
-      </tp:docstring>
-      <tp:possible-errors>
-        <tp:error name="org.freedesktop.Telepathy.Error.InvalidArgument"/>
-      </tp:possible-errors>
-    </method>
-
-    <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
-      <p>An interface on connections to search and request buddies</p>
-    </tp:docstring>
-  </interface>
-</node>
-<!-- vim:set sw=2 sts=2 et ft=xml: -->
diff --git a/extensions/all.xml b/extensions/all.xml
index 599cb11..ccb15d0 100644
--- a/extensions/all.xml
+++ b/extensions/all.xml
@@ -27,10 +27,9 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA</p>
 <xi:include href="Connection_Interface_Requests.xml"/>
 <xi:include href="OLPC_Buddy_Info.xml"/>
 <xi:include href="OLPC_Activity_Properties.xml"/>
-<xi:include href="OLPC_Buddy.xml"/>
 <xi:include href="OLPC_Buddy_View.xml"/>
-<xi:include href="OLPC_Activity.xml"/>
 <xi:include href="OLPC_Activity_View.xml"/>
+<xi:include href="OLPC_Gadget.xml"/>
 
 <tp:generic-types>
   <tp:external-type name="Contact_Handle" type="u"
diff --git a/src/conn-olpc.c b/src/conn-olpc.c
index 07d05fe..93fe69f 100644
--- a/src/conn-olpc.c
+++ b/src/conn-olpc.c
@@ -3203,9 +3203,9 @@ buddy_query_result_cb (GabbleConnection *conn,
 }
 
 static void
-olpc_buddy_request_random (GabbleSvcOLPCBuddy *iface,
-                           guint max,
-                           DBusGMethodInvocation *context)
+olpc_gadget_request_random_buddies (GabbleSvcOLPCGadget *iface,
+                                    guint max,
+                                    DBusGMethodInvocation *context)
 {
   GabbleConnection *conn = GABBLE_CONNECTION (iface);
   LmMessage *query;
@@ -3273,16 +3273,17 @@ olpc_buddy_request_random (GabbleSvcOLPCBuddy *iface,
       return;
     }
 
-  gabble_svc_olpc_buddy_return_from_request_random (context, object_path);
+  gabble_svc_olpc_gadget_return_from_request_random_buddies (context,
+      object_path);
 
   g_free (object_path);
   lm_message_unref (query);
 }
 
 static void
-olpc_buddy_search_by_properties (GabbleSvcOLPCBuddy *iface,
-                                 GHashTable *properties,
-                                 DBusGMethodInvocation *context)
+olpc_gadget_search_buddies_by_properties (GabbleSvcOLPCGadget *iface,
+                                          GHashTable *properties,
+                                          DBusGMethodInvocation *context)
 {
   GabbleConnection *conn = GABBLE_CONNECTION (iface);
   LmMessage *query;
@@ -3345,25 +3346,13 @@ olpc_buddy_search_by_properties (GabbleSvcOLPCBuddy *iface,
       return;
     }
 
-  gabble_svc_olpc_buddy_return_from_search_by_properties (context, object_path);
+  gabble_svc_olpc_gadget_return_from_search_buddies_by_properties (context,
+      object_path);
 
   g_free (object_path);
   lm_message_unref (query);
 }
 
-void
-olpc_buddy_iface_init (gpointer g_iface,
-                       gpointer iface_data)
-{
-  GabbleSvcOLPCBuddyClass *klass = g_iface;
-
-#define IMPLEMENT(x) gabble_svc_olpc_buddy_implement_##x (\
-    klass, olpc_buddy_##x)
-  IMPLEMENT(request_random);
-  IMPLEMENT(search_by_properties);
-#undef IMPLEMENT
-}
-
 static LmHandlerResult
 activity_query_result_cb (GabbleConnection *conn,
                           LmMessage *sent_msg,
@@ -3457,9 +3446,9 @@ create_activity_view (GabbleConnection *conn)
 }
 
 static void
-olpc_activity_request_random (GabbleSvcOLPCActivity *iface,
-                              guint max,
-                              DBusGMethodInvocation *context)
+olpc_gadget_request_random_activities (GabbleSvcOLPCGadget *iface,
+                                       guint max,
+                                       DBusGMethodInvocation *context)
 {
   GabbleConnection *conn = GABBLE_CONNECTION (iface);
   LmMessage *query;
@@ -3527,16 +3516,17 @@ olpc_activity_request_random (GabbleSvcOLPCActivity *iface,
       return;
     }
 
-  gabble_svc_olpc_activity_return_from_request_random (context, object_path);
+  gabble_svc_olpc_gadget_return_from_request_random_activities (context,
+      object_path);
 
   g_free (object_path);
   lm_message_unref (query);
 }
 
 static void
-olpc_activity_search_by_properties (GabbleSvcOLPCActivity *iface,
-                                    GHashTable *properties,
-                                    DBusGMethodInvocation *context)
+olpc_gadget_search_activities_by_properties (GabbleSvcOLPCGadget *iface,
+                                             GHashTable *properties,
+                                             DBusGMethodInvocation *context)
 {
   GabbleConnection *conn = GABBLE_CONNECTION (iface);
   LmMessage *query;
@@ -3599,16 +3589,17 @@ olpc_activity_search_by_properties (GabbleSvcOLPCActivity *iface,
       return;
     }
 
-  gabble_svc_olpc_activity_return_from_search_by_properties (context, object_path);
+  gabble_svc_olpc_gadget_return_from_search_activities_by_properties (context,
+      object_path);
 
   g_free (object_path);
   lm_message_unref (query);
 }
 
 static void
-olpc_activity_search_by_participants (GabbleSvcOLPCActivity *iface,
-                                      const GArray *participants,
-                                      DBusGMethodInvocation *context)
+olpc_gadget_search_activities_by_participants (GabbleSvcOLPCGadget *iface,
+                                               const GArray *participants,
+                                               DBusGMethodInvocation *context)
 {
   GabbleConnection *conn = GABBLE_CONNECTION (iface);
   LmMessage *query;
@@ -3679,7 +3670,7 @@ olpc_activity_search_by_participants (GabbleSvcOLPCActivity *iface,
       return;
     }
 
-  gabble_svc_olpc_activity_return_from_search_by_participants (context,
+  gabble_svc_olpc_gadget_return_from_search_activities_by_participants (context,
       object_path);
 
   g_free (object_path);
@@ -3687,15 +3678,17 @@ olpc_activity_search_by_participants (GabbleSvcOLPCActivity *iface,
 }
 
 void
-olpc_activity_iface_init (gpointer g_iface,
-                          gpointer iface_data)
-{
-  GabbleSvcOLPCActivityClass *klass = g_iface;
-
-#define IMPLEMENT(x) gabble_svc_olpc_activity_implement_##x (\
-    klass, olpc_activity_##x)
-  IMPLEMENT(request_random);
-  IMPLEMENT(search_by_properties);
-  IMPLEMENT(search_by_participants);
+olpc_gadget_iface_init (gpointer g_iface,
+                        gpointer iface_data)
+{
+  GabbleSvcOLPCGadgetClass *klass = g_iface;
+
+#define IMPLEMENT(x) gabble_svc_olpc_gadget_implement_##x (\
+    klass, olpc_gadget_##x)
+  IMPLEMENT(request_random_buddies);
+  IMPLEMENT(search_buddies_by_properties);
+  IMPLEMENT(request_random_activities);
+  IMPLEMENT(search_activities_by_properties);
+  IMPLEMENT(search_activities_by_participants);
 #undef IMPLEMENT
 }
diff --git a/src/conn-olpc.h b/src/conn-olpc.h
index d7acd0b..2fc7e06 100644
--- a/src/conn-olpc.h
+++ b/src/conn-olpc.h
@@ -60,9 +60,7 @@ gboolean conn_olpc_process_activity_uninvite_message (GabbleConnection *conn,
 LmHandlerResult conn_olpc_msg_cb (LmMessageHandler *handler,
     LmConnection *connection, LmMessage *message, gpointer user_data);
 
-void olpc_buddy_iface_init (gpointer g_iface, gpointer iface_data);
-
-void olpc_activity_iface_init (gpointer g_iface, gpointer iface_data);
+void olpc_gadget_iface_init (gpointer g_iface, gpointer iface_data);
 
 #endif /* __CONN_OLPC_H__ */
 
diff --git a/src/connection.c b/src/connection.c
index b9c9e95..cd44f9e 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -102,10 +102,8 @@ G_DEFINE_TYPE_WITH_CODE(GabbleConnection,
       olpc_buddy_info_iface_init);
     G_IMPLEMENT_INTERFACE (GABBLE_TYPE_SVC_OLPC_ACTIVITY_PROPERTIES,
       olpc_activity_properties_iface_init);
-    G_IMPLEMENT_INTERFACE (GABBLE_TYPE_SVC_OLPC_BUDDY,
-      olpc_buddy_iface_init);
-    G_IMPLEMENT_INTERFACE (GABBLE_TYPE_SVC_OLPC_ACTIVITY,
-      olpc_activity_iface_init);
+    G_IMPLEMENT_INTERFACE (GABBLE_TYPE_SVC_OLPC_GADGET,
+      olpc_gadget_iface_init);
     )
 
 /* properties */
@@ -2041,8 +2039,8 @@ connection_disco_cb (GabbleDisco *disco,
   if (conn->features && GABBLE_CONNECTION_FEATURES_PEP)
     {
       const gchar *ifaces[] = { GABBLE_IFACE_OLPC_BUDDY_INFO,
-          GABBLE_IFACE_OLPC_ACTIVITY_PROPERTIES, GABBLE_IFACE_OLPC_BUDDY,
-          GABBLE_IFACE_OLPC_ACTIVITY, NULL };
+          GABBLE_IFACE_OLPC_ACTIVITY_PROPERTIES, GABBLE_IFACE_OLPC_GADGET,
+          NULL };
 
       tp_base_connection_add_interfaces ((TpBaseConnection *) conn, ifaces);
     }
diff --git a/tests/twisted/olpc/olpc-activity-search.py b/tests/twisted/olpc/olpc-activity-search.py
index ba9e133..98d8f95 100644
--- a/tests/twisted/olpc/olpc-activity-search.py
+++ b/tests/twisted/olpc/olpc-activity-search.py
@@ -57,16 +57,16 @@ def test(q, bus, conn, stream):
     stream.send(reply)
 
     activity_prop_iface = dbus.Interface(conn, 'org.laptop.Telepathy.ActivityProperties')
-    activity_iface = dbus.Interface(conn, 'org.laptop.Telepathy.Activity')
+    gadget_iface = dbus.Interface(conn, 'org.laptop.Telepathy.Gadget')
 
     sync_stream(q, stream)
 
     # request 3 random activities
-    call_async(q, activity_iface, 'RequestRandom', 3)
+    call_async(q, gadget_iface, 'RequestRandomActivities', 3)
 
     iq_event, return_event = q.expect_many(
         EventPattern('stream-iq', to='gadget.localhost', query_ns=NS_OLPC_ACTIVITY),
-        EventPattern('dbus-return', method='RequestRandom'))
+        EventPattern('dbus-return', method='RequestRandomActivities'))
 
     query = iq_event.stanza.firstChildElement()
     assert query.name == 'query'
@@ -100,11 +100,11 @@ def test(q, bus, conn, stream):
 
     # activity search by properties
     props = {'color': '#AABBCC,#001122'}
-    call_async(q, activity_iface, 'SearchByProperties', props)
+    call_async(q, gadget_iface, 'SearchActivitiesByProperties', props)
 
     iq_event, return_event = q.expect_many(
         EventPattern('stream-iq', to='gadget.localhost', query_ns=NS_OLPC_ACTIVITY),
-        EventPattern('dbus-return', method='SearchByProperties'))
+        EventPattern('dbus-return', method='SearchActivitiesByProperties'))
 
     properties = xpath.queryForNodes('/iq/query/activity/properties/property', iq_event.stanza)
     query = iq_event.stanza.firstChildElement()
@@ -141,11 +141,11 @@ def test(q, bus, conn, stream):
 
     # activity search by participants
     participants = conn.RequestHandles(1, ["alice at localhost", "bob at localhost"])
-    call_async(q, activity_iface, 'SearchByParticipants', participants)
+    call_async(q, gadget_iface, 'SearchActivitiesByParticipants', participants)
 
     iq_event, return_event = q.expect_many(
         EventPattern('stream-iq', to='gadget.localhost', query_ns=NS_OLPC_ACTIVITY),
-        EventPattern('dbus-return', method='SearchByParticipants'))
+        EventPattern('dbus-return', method='SearchActivitiesByParticipants'))
 
     buddies = xpath.queryForNodes('/iq/query/activity/buddy', iq_event.stanza)
     query = iq_event.stanza.firstChildElement()
diff --git a/tests/twisted/olpc/olpc-buddy-search.py b/tests/twisted/olpc/olpc-buddy-search.py
index bdff05d..f20ea5f 100644
--- a/tests/twisted/olpc/olpc-buddy-search.py
+++ b/tests/twisted/olpc/olpc-buddy-search.py
@@ -57,7 +57,7 @@ def test(q, bus, conn, stream):
     stream.send(reply)
 
     buddy_info_iface = dbus.Interface(conn, 'org.laptop.Telepathy.BuddyInfo')
-    buddy_iface = dbus.Interface(conn, 'org.laptop.Telepathy.Buddy')
+    gadget_iface = dbus.Interface(conn, 'org.laptop.Telepathy.Gadget')
 
     call_async(q, conn, 'RequestHandles', 1, ['bob at localhost'])
 
@@ -107,11 +107,11 @@ def test(q, bus, conn, stream):
     assert props == {'color': '#005FE4,#00A0FF' }
 
     # request 3 random buddies
-    call_async(q, buddy_iface, 'RequestRandom', 3)
+    call_async(q, gadget_iface, 'RequestRandomBuddies', 3)
 
     iq_event, return_event = q.expect_many(
         EventPattern('stream-iq', to='gadget.localhost', query_ns=NS_OLPC_BUDDY),
-        EventPattern('dbus-return', method='RequestRandom'))
+        EventPattern('dbus-return', method='RequestRandomBuddies'))
 
     query = iq_event.stanza.firstChildElement()
     assert query.name == 'query'
@@ -153,11 +153,11 @@ def test(q, bus, conn, stream):
 
     # buddy search
     props = {'color': '#AABBCC,#001122'}
-    call_async(q, buddy_iface, 'SearchByProperties', props)
+    call_async(q, gadget_iface, 'SearchBuddiesByProperties', props)
 
     iq_event, return_event = q.expect_many(
         EventPattern('stream-iq', to='gadget.localhost', query_ns=NS_OLPC_BUDDY),
-        EventPattern('dbus-return', method='SearchByProperties'))
+        EventPattern('dbus-return', method='SearchBuddiesByProperties'))
 
     properties = xpath.queryForNodes('/iq/query/buddy/properties/property', iq_event.stanza)
     query = iq_event.stanza.firstChildElement()
-- 
1.5.6.5




More information about the Telepathy-commits mailing list