[Telepathy-commits] [telepathy-gabble/master] Add support for the Contacts interface

Sjoerd Simons sjoerd at luon.net
Tue Aug 19 10:54:23 PDT 2008


20080728163929-93b9a-196f5df4b207c0bee6c3ddd5897d00af45a338d9.gz
---
 src/conn-presence.c |    4 ++++
 src/connection.c    |   11 +++++++++++
 src/connection.h    |    3 +++
 3 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/src/conn-presence.c b/src/conn-presence.c
index 446eeb5..c58b4b6 100644
--- a/src/conn-presence.c
+++ b/src/conn-presence.c
@@ -26,6 +26,7 @@
 #include <telepathy-glib/presence-mixin.h>
 #include <telepathy-glib/svc-connection.h>
 #include <telepathy-glib/util.h>
+#include <telepathy-glib/interfaces.h>
 
 #define DEBUG_FLAG GABBLE_DEBUG_CONNECTION
 
@@ -327,6 +328,9 @@ conn_presence_init (GabbleConnection *conn)
 
   tp_presence_mixin_init ((GObject *) conn,
       G_STRUCT_OFFSET (GabbleConnection, presence));
+
+  tp_presence_mixin_simple_presence_register_with_contacts_iface (
+      G_OBJECT (conn));
 }
 
 
diff --git a/src/connection.c b/src/connection.c
index d024494..e224bbd 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -86,6 +86,8 @@ G_DEFINE_TYPE_WITH_CODE(GabbleConnection,
       capabilities_service_iface_init);
     G_IMPLEMENT_INTERFACE(TP_TYPE_SVC_DBUS_PROPERTIES,
        tp_dbus_properties_mixin_iface_init);
+    G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CONNECTION_INTERFACE_CONTACTS,
+      tp_contacts_mixin_iface_init);
     G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CONNECTION_INTERFACE_SIMPLE_PRESENCE,
       tp_presence_mixin_simple_presence_iface_init);
     G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CONNECTION_INTERFACE_PRESENCE,
@@ -234,6 +236,9 @@ gabble_connection_constructor (GType type,
 
   capabilities_fill_cache (self->presence_cache);
 
+  tp_contacts_mixin_init (G_OBJECT (self),
+      G_STRUCT_OFFSET (GabbleConnection, contacts));
+
   conn_avatars_init (self);
   conn_presence_init (self);
   conn_olpc_activity_properties_init (self);
@@ -480,6 +485,7 @@ gabble_connection_class_init (GabbleConnectionClass *gabble_connection_class)
       TP_IFACE_CONNECTION_INTERFACE_SIMPLE_PRESENCE,
       TP_IFACE_CONNECTION_INTERFACE_PRESENCE,
       TP_IFACE_CONNECTION_INTERFACE_AVATARS,
+      TP_IFACE_CONNECTION_INTERFACE_CONTACTS,
       NULL };
 
   DEBUG("Initializing (GabbleConnectionClass *)%p", gabble_connection_class);
@@ -643,6 +649,9 @@ gabble_connection_class_init (GabbleConnectionClass *gabble_connection_class)
   tp_dbus_properties_mixin_class_init (object_class,
       G_STRUCT_OFFSET (GabbleConnectionClass, properties_class));
 
+  tp_contacts_mixin_class_init (object_class,
+      G_STRUCT_OFFSET (GabbleConnectionClass, contacts_class));
+
   conn_presence_class_init (gabble_connection_class);
 
 }
@@ -744,6 +753,8 @@ gabble_connection_finalize (GObject *object)
 
   g_free (priv->alias);
 
+  tp_contacts_mixin_finalize (G_OBJECT(self));
+
   conn_presence_finalize (self);
 
   G_OBJECT_CLASS (gabble_connection_parent_class)->finalize (object);
diff --git a/src/connection.h b/src/connection.h
index 4e5a235..273c43d 100644
--- a/src/connection.h
+++ b/src/connection.h
@@ -25,6 +25,7 @@
 #include <glib-object.h>
 #include <loudmouth/loudmouth.h>
 #include <telepathy-glib/base-connection.h>
+#include <telepathy-glib/contacts-mixin.h>
 #include <telepathy-glib/presence-mixin.h>
 #include <telepathy-glib/dbus-properties-mixin.h>
 
@@ -102,11 +103,13 @@ struct _GabbleConnectionClass {
     TpBaseConnectionClass parent_class;
     TpDBusPropertiesMixinClass properties_class;
     TpPresenceMixinClass presence_class;
+    TpContactsMixinClass contacts_class;
 };
 
 struct _GabbleConnection {
     TpBaseConnection parent;
     TpPresenceMixin presence;
+    TpContactsMixin contacts;
 
     /* loudmouth connection */
     LmConnection *lmconn;
-- 
1.5.6.3




More information about the Telepathy-commits mailing list