soc.2009.telepathy: e1c3ed0f: Added libtelepathy stuff

sttwister at soc.pidgin.im sttwister at soc.pidgin.im
Wed Apr 29 16:16:22 EDT 2009


-----------------------------------------------------------------
Revision: e1c3ed0fc02e63310d27b925a59acd6cc42390ea
Ancestor: 9f2df692f65cef28256c0dd673877a6509ed5704
Author: sttwister at soc.pidgin.im
Date: 2009-04-29T20:08:39
Branch: im.pidgin.soc.2009.telepathy
URL: http://d.pidgin.im/viewmtn/revision/info/e1c3ed0fc02e63310d27b925a59acd6cc42390ea

Modified files:
        libpurple/protocols/telepathy/Makefile.am
        libpurple/protocols/telepathy/telepathy.c

ChangeLog: 

Added libtelepathy stuff

-------------- next part --------------
============================================================
--- libpurple/protocols/telepathy/Makefile.am	c597e4f864d5141932dad3dcf1121411df668c83
+++ libpurple/protocols/telepathy/Makefile.am	9084a1a81d3abd8c1c34d13271e194bc8dda3d83
@@ -7,7 +7,7 @@ AM_CFLAGS = $(st)
 
 AM_CFLAGS = $(st)
 
-libtelepathy_la_LDFLAGS = -module -avoid-version
+libtelepathy_la_LDFLAGS = -module -avoid-version `pkg-config --libs telepathy-glib`
 
 st =
 pkg_LTLIBRARIES    = libtelepathy.la
@@ -18,4 +18,5 @@ AM_CPPFLAGS = \
 	-I$(top_srcdir)/libpurple \
 	-I$(top_builddir)/libpurple \
 	$(GLIB_CFLAGS) \
+        `pkg-config --cflags telepathy-glib` \
 	$(DEBUG_CFLAGS)
============================================================
--- libpurple/protocols/telepathy/telepathy.c	d56cd589eee2f61f17a5b22834855ab4a104448b
+++ libpurple/protocols/telepathy/telepathy.c	0414d6693a3509ba72a2a0fa66988ffd8b864766
@@ -20,6 +20,13 @@
 
 #include <glib.h>
 
+#include <telepathy-glib/connection-manager.h>
+#include <telepathy-glib/connection.h>
+#include <telepathy-glib/channel.h>
+#include <telepathy-glib/dbus.h>
+#include <telepathy-glib/debug.h>
+#include <telepathy-glib/util.h>
+
 #include "internal.h"
 
 #include "accountopt.h"
@@ -258,4 +265,51 @@ telepathy_init(PurplePlugin *plugin)
 	telepathy_prpl_info.protocol_options = g_list_append(telepathy_prpl_info.protocol_options, option);
 }
 
+/*
 PURPLE_INIT_PLUGIN(telepathy, telepathy_init, telepathy_info)
+*/
+
+static void
+list_connection_managers_cb (TpConnectionManager * const *cms,
+				  gsize n_cms,
+				  const GError *error,
+				  gpointer user_data,
+				  GObject *weak_object)
+{
+	if (error != NULL)
+	{
+		purple_debug_error("telepathy", "Failed to list connection managers: %s\n", error->message);
+		g_error_free((GError*)error);
+	}
+	else
+	{
+		purple_debug_info("telepathy", "Got %d connection managers\n", n_cms);
+	}
+}
+
+G_MODULE_EXPORT gboolean purple_init_plugin(PurplePlugin *plugin); 
+G_MODULE_EXPORT gboolean purple_init_plugin(PurplePlugin *plugin)
+{
+	static TpDBusDaemon *daemon = NULL;
+	GError *error = NULL;
+
+	purple_debug_info("telepathy", "Querying telepathy for connectin managers...\n");
+
+	/* the daemon is used to communicate via DBus */
+	daemon = tp_dbus_daemon_new(&error);
+	purple_debug_info("telepathy", "Querying telepathy for connectin managers...\n");
+	if (daemon == NULL)
+	{
+	    purple_debug_error("telepathy", "Cannot create DBus daemon: %s\n", error->message);
+	    g_error_free(error);
+	    return FALSE;
+	}
+	if (daemon != NULL)
+	    g_object_unref(daemon);
+	return FALSE;
+
+	tp_list_connection_managers(daemon, list_connection_managers_cb, NULL, NULL, NULL);
+
+	
+	return TRUE;
+}


More information about the Commits mailing list