[Telepathy-commits] [telepathy-haze/master] Connection: implement Contacts
Will Thompson
will.thompson at collabora.co.uk
Mon Oct 27 17:19:52 PDT 2008
---
src/connection.c | 15 +++++++++++++++
src/connection.h | 3 +++
2 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/src/connection.c b/src/connection.c
index 8147336..55942ef 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -53,6 +53,8 @@ G_DEFINE_TYPE_WITH_CODE(HazeConnection,
TP_TYPE_BASE_CONNECTION,
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_PRESENCE,
tp_presence_mixin_iface_init);
G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CONNECTION_INTERFACE_SIMPLE_PRESENCE,
@@ -510,6 +512,8 @@ haze_connection_finalize (GObject *object)
{
tp_presence_mixin_finalize (object);
+ tp_contacts_mixin_finalize (object);
+
G_OBJECT_CLASS (haze_connection_parent_class)->finalize (object);
}
@@ -520,6 +524,7 @@ haze_connection_class_init (HazeConnectionClass *klass)
TpBaseConnectionClass *base_class = TP_BASE_CONNECTION_CLASS (klass);
GParamSpec *param_spec;
static const gchar *interfaces_always_present[] = {
+ TP_IFACE_CONNECTION_INTERFACE_CONTACTS,
TP_IFACE_CONNECTION_INTERFACE_PRESENCE,
TP_IFACE_CONNECTION_INTERFACE_SIMPLE_PRESENCE,
/* TODO: This is a lie. Not all protocols supported by libpurple
@@ -570,6 +575,9 @@ haze_connection_class_init (HazeConnectionClass *klass)
tp_dbus_properties_mixin_class_init (object_class, 0);
+ tp_contacts_mixin_class_init (object_class,
+ G_STRUCT_OFFSET (HazeConnectionClass, contacts_class));
+
haze_connection_presence_class_init (object_class);
haze_connection_aliasing_class_init (object_class);
haze_connection_avatars_class_init (object_class);
@@ -578,10 +586,17 @@ haze_connection_class_init (HazeConnectionClass *klass)
static void
haze_connection_init (HazeConnection *self)
{
+ TpBaseConnection *base_conn = (TpBaseConnection *) self;
+
DEBUG ("Initializing (HazeConnection *)%p", self);
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, HAZE_TYPE_CONNECTION,
HazeConnectionPrivate);
+ tp_contacts_mixin_init ((GObject *) self,
+ G_STRUCT_OFFSET (HazeConnection, contacts));
+
+ tp_base_connection_register_with_contacts_mixin (base_conn);
+
haze_connection_presence_init (self);
}
diff --git a/src/connection.h b/src/connection.h
index 0fd6f4d..ad9d992 100644
--- a/src/connection.h
+++ b/src/connection.h
@@ -23,6 +23,7 @@
#include <glib-object.h>
#include <telepathy-glib/base-connection.h>
+#include <telepathy-glib/contacts-mixin.h>
#include <telepathy-glib/presence-mixin.h>
#include <libpurple/account.h>
@@ -51,6 +52,7 @@ typedef struct _HazeConnectionClass HazeConnectionClass;
struct _HazeConnectionClass {
TpBaseConnectionClass parent_class;
TpPresenceMixinClass presence_class;
+ TpContactsMixinClass contacts_class;
};
struct _HazeConnection {
@@ -62,6 +64,7 @@ struct _HazeConnection {
HazeImChannelFactory *im_factory;
TpPresenceMixin presence;
+ TpContactsMixin contacts;
gpointer priv;
};
--
1.5.6.5
More information about the Telepathy-commits
mailing list