summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Barnett <jbarnett@stanfordalumni.org>2012-04-10 16:22:36 -0700
committerJoe Barnett <jbarnett@stanfordalumni.org>2012-04-10 16:22:36 -0700
commit10701fb72fb8acbe15127818df0715e44cf9bb3a (patch)
tree426a32f47afbc1bf17a7f973621d1910b9103af0
parente6d0eea029485146524d32b9956aebfaf04169c8 (diff)
get successful connection by including contacts mixin
-rw-r--r--.gitignore1
-rw-r--r--src/kindling-connection.c7
-rw-r--r--src/kindling-connection.h3
-rw-r--r--src/kindling-muc-manager.c5
-rw-r--r--src/kindling-protocol.c10
5 files changed, 19 insertions, 7 deletions
diff --git a/.gitignore b/.gitignore
index 9d02e2b..53ca8e0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -21,3 +21,4 @@ src/.deps
libtool
src/*.o
src/telepathy_kindling
+*~
diff --git a/src/kindling-connection.c b/src/kindling-connection.c
index 51f7e06..7c77fc8 100644
--- a/src/kindling-connection.c
+++ b/src/kindling-connection.c
@@ -25,7 +25,9 @@ telepathy-kindling is free software: you can redistribute it and/or modify it
#include <libsoup/soup.h>
#include <json-glib/json-glib.h>
-G_DEFINE_TYPE (KindlingConnection, kindling_connection, TP_TYPE_BASE_CONNECTION);
+G_DEFINE_TYPE_WITH_CODE (KindlingConnection, kindling_connection, TP_TYPE_BASE_CONNECTION,
+ G_IMPLEMENT_INTERFACE(TP_TYPE_SVC_CONNECTION_INTERFACE_CONTACTS, tp_contacts_mixin_iface_init)
+);
static const gchar * interfaces_always_present[] = {
TP_IFACE_CONNECTION_INTERFACE_ALIASING,
@@ -106,6 +108,8 @@ static void kindling_connection_get_property(GObject *obj, guint prop_id, GValue
static void
kindling_connection_init (KindlingConnection *kindling_connection) {
g_printf("connection init\n");
+ tp_contacts_mixin_init ((GObject *) kindling_connection, G_STRUCT_OFFSET (KindlingConnection, contacts));
+ tp_base_connection_register_with_contacts_mixin((TpBaseConnection *)kindling_connection);
}
static void _soup_authenticate_cb(SoupSession *session,
@@ -144,6 +148,7 @@ kindling_connection_finalize (GObject *object) {
g_signal_handler_disconnect(priv->soup_session, priv->soup_auth_cb_handle);
g_object_unref(priv->soup_session);
+ tp_contacts_mixin_finalize (object);
g_printf("finalize kindling connection object\n");
G_OBJECT_CLASS (kindling_connection_parent_class)->finalize (object);
}
diff --git a/src/kindling-connection.h b/src/kindling-connection.h
index 263d172..ef188bb 100644
--- a/src/kindling-connection.h
+++ b/src/kindling-connection.h
@@ -22,6 +22,7 @@ telepathy-kindling is free software: you can redistribute it and/or modify it
#include <glib-object.h>
#include <telepathy-glib/base-protocol.h>
+#include <telepathy-glib/contacts-mixin.h>
G_BEGIN_DECLS
@@ -40,11 +41,13 @@ typedef struct _KindlingConnection KindlingConnection;
struct _KindlingConnectionClass
{
TpBaseConnectionClass parent_class;
+ TpContactsMixinClass contacts;
};
struct _KindlingConnection
{
TpBaseConnection parent_instance;
+ TpContactsMixin contacts;
};
diff --git a/src/kindling-muc-manager.c b/src/kindling-muc-manager.c
index eb7be5f..af950e0 100644
--- a/src/kindling-muc-manager.c
+++ b/src/kindling-muc-manager.c
@@ -29,7 +29,7 @@ G_DEFINE_TYPE_WITH_CODE (KindlingMUCManager, kindling_muc_manager, G_TYPE_OBJECT
static void
kindling_muc_manager_init (KindlingMUCManager *kindling_muc_manager)
{
-
+ g_printf("init kindling muc manager\n");
/* TODO: Add initialization code here */
}
@@ -37,6 +37,7 @@ kindling_muc_manager_init (KindlingMUCManager *kindling_muc_manager)
static void
kindling_muc_manager_finalize (GObject *object)
{
+ g_printf("finalize kindling muc manager\n");
/* TODO: Add deinitalization code here */
G_OBJECT_CLASS (kindling_muc_manager_parent_class)->finalize (object);
@@ -45,6 +46,7 @@ kindling_muc_manager_finalize (GObject *object)
static void
kindling_muc_manager_class_init (KindlingMUCManagerClass *klass)
{
+ g_printf("class init kindling muc manager\n");
GObjectClass* object_class = G_OBJECT_CLASS (klass);
GObjectClass* parent_class = G_OBJECT_CLASS (klass);
@@ -52,5 +54,6 @@ kindling_muc_manager_class_init (KindlingMUCManagerClass *klass)
}
static void _muc_manager_iface_init(gpointer g_iface, gpointer iface_data) {
+ g_printf("iface init kindling muc manager\n");
TpChannelManagerIface *iface = g_iface;
}
diff --git a/src/kindling-protocol.c b/src/kindling-protocol.c
index e252828..7806b66 100644
--- a/src/kindling-protocol.c
+++ b/src/kindling-protocol.c
@@ -80,7 +80,7 @@ static void get_connection_details(TpBaseProtocol *self,
gchar **icon_name,
char **english_name,
gchar **vcard_field) {
- g_printf("called get details\n");
+ g_printf("called protocol get details\n");
if (connection_interfaces != NULL) {
*connection_interfaces = g_strdupv((GStrv) kindling_connection_get_implemented_interfaces());
}
@@ -104,19 +104,19 @@ static void get_connection_details(TpBaseProtocol *self,
static GStrv
dup_authentication_types (TpBaseProtocol *base) {
- g_printf("duping auth types\n");
+ g_printf("protocol duping auth types\n");
const gchar * const types [] = {
TP_IFACE_CHANNEL_INTERFACE_SASL_AUTHENTICATION, NULL, };
return g_strdupv((GStrv)types);
}
static gchar *normalize_contact(TpBaseProtocol *self, const gchar *contact, GError **error) {
- g_printf("normalizing contact\n");
+ g_printf("protocol normalizing contact\n");
return g_strdupv(contact);
}
static char *identify_account(TpBaseProtocol *self, GHashTable *asv, GError **error) {
- g_printf("identing account\n");
+ g_printf("protocol identing account\n");
gchar *nick = g_strdupv(tp_asv_get_string(asv, "username"));
gchar *server = g_strdupv(tp_asv_get_string(asv, "server"));
gchar *nick_at_server = g_strdup_printf("%s@%s", nick, server);
@@ -128,7 +128,7 @@ static char *identify_account(TpBaseProtocol *self, GHashTable *asv, GError **er
static GStrv
get_interfaces (TpBaseProtocol *self)
{
- g_printf("get interfaces\n");
+ g_printf("protocol get interfaces\n");
return g_new0 (gchar *, 1);
}