soc.2009.telepathy: 069d7166: Ported connection code to some pathetic ...

sttwister at soc.pidgin.im sttwister at soc.pidgin.im
Wed Jul 22 18:15:34 EDT 2009


-----------------------------------------------------------------
Revision: 069d7166a82c2c0707ac394ee3f4429db7b78dfb
Ancestor: 667b5e8081964880be78106efeeb1d79a3648ee3
Author: sttwister at soc.pidgin.im
Date: 2009-07-22T22:09:32
Branch: im.pidgin.soc.2009.telepathy
URL: http://d.pidgin.im/viewmtn/revision/info/069d7166a82c2c0707ac394ee3f4429db7b78dfb

Modified files:
        libpurple/protocols/telepathy/telepathy.c
        libpurple/protocols/telepathy/telepathy_account.c
        libpurple/protocols/telepathy/telepathy_account.h
        libpurple/protocols/telepathy/telepathy_client.c
        libpurple/protocols/telepathy/telepathy_utils.c
        libpurple/protocols/telepathy/telepathy_utils.h

ChangeLog: 

Ported connection code to some pathetic attempt to use MC5

-------------- next part --------------
============================================================
--- libpurple/protocols/telepathy/telepathy.c	6b592bf2092386aa160d927999559a0a77320ecd
+++ libpurple/protocols/telepathy/telepathy.c	38773de2ee02f0a42dac615ded6d5cb9004a5a41
@@ -46,6 +46,7 @@
 #include "telepathy_channel.h"
 #include "telepathy_channel_list.h"
 #include "telepathy_channel_text.h"
+#include "telepathy_client.h"
 #include "telepathy_connection.h"
 #include "telepathy_contact.h"
 #include "telepathy_utils.h"
@@ -194,6 +195,43 @@ telepathy_login(PurpleAccount *acct)
 static void
 telepathy_login(PurpleAccount *acct)
 {
+	GValueArray *initial_presence;
+
+	telepathy_account *account_data = (telepathy_account*)purple_account_get_int(
+			acct, "tp_account_data", 0);
+
+	purple_debug_info("telepathy", "Connecting to account %s\n",
+			purple_account_get_username(acct));
+
+	if (account_data == NULL)
+	{
+		purple_debug_error("telepathy", "Account %s doesn't have tp_account_data\n",
+				purple_account_get_username(acct));
+		return;
+	}
+
+
+	initial_presence = g_value_array_new(3);
+	g_value_array_append(initial_presence, tp_g_value_slice_new_uint(2)); /* online */
+	g_value_array_append(initial_presence, tp_g_value_slice_new_string("online"));
+	g_value_array_append(initial_presence, tp_g_value_slice_new_string("Woot I'm online"));
+
+	tp_cli_dbus_properties_call_set(account_data->tp_account, -1,
+		TP_IFACE_ACCOUNT, "Enabled", tp_g_value_slice_new_boolean(TRUE),
+		NULL, NULL, NULL, NULL);
+
+	tp_cli_dbus_properties_call_set(account_data->tp_account, -1,
+		TP_IFACE_ACCOUNT, "RequestedPresence",
+		tp_g_value_slice_new_boxed(G_TYPE_VALUE_ARRAY, initial_presence),
+		NULL, NULL, NULL, NULL);
+
+	g_value_array_free(initial_presence);
+
+}
+
+static void
+telepathy_login_old(PurpleAccount *acct)
+{
 	PurpleConnection *gc = purple_account_get_connection(acct);
 
 	PurplePlugin* plugin = gc->prpl;
@@ -728,21 +766,6 @@ static void
 }
 
 static void
-set_properties_cb (TpProxy *proxy,
-                   const GError *error,
-                   gpointer user_data,
-                   GObject *weak_object)
-{
-	if (error != NULL)
-	{
-		purple_debug_info("telepathy", "SetProperties error: %s\n", error->message);
-		return;
-	}
-
-	purple_debug_info("telepathy", "SetProperties succeeded!\n");
-}
-
-static void
 telepathy_set_chat_topic (PurpleConnection *gc, int id, const char *topic)
 {
 	telepathy_connection *data = purple_connection_get_protocol_data(gc);
@@ -1225,5 +1248,8 @@ G_MODULE_EXPORT gboolean purple_init_plu
 	if (daemon != NULL)
 		g_object_unref(daemon);
 
+	/* Create the Client.Handler object */
+	telepathy_client_dup_singleton();
+
 	return TRUE;
 }
============================================================
--- libpurple/protocols/telepathy/telepathy_account.c	fe5599a0202c1de2e6fccf2ed2b510dc7acab81f
+++ libpurple/protocols/telepathy/telepathy_account.c	0ab26f7acd71957ad4edfbcde3d590b1d9412ec4
@@ -33,7 +33,7 @@
 #include "debug.h"
 #include "../../../pidgin/gtkaccount.h"
 
-static void
+void
 update_parameters_cb (TpAccount *proxy,
                       const gchar **out_Reconnect_Required,
                       const GError *error,
============================================================
--- libpurple/protocols/telepathy/telepathy_account.h	211e13ff966bb57b74bacf6b9b8f4e14ebeaf124
+++ libpurple/protocols/telepathy/telepathy_account.h	a9cc8e064616b8ae66d7ce9a1391495aca0fe82a
@@ -36,6 +36,13 @@ void
 } telepathy_account;
 
 void
+update_parameters_cb (TpAccount *proxy,
+                      const gchar **out_Reconnect_Required,
+                      const GError *error,
+                      gpointer user_data,
+                      GObject *weak_object);
+
+void
 get_valid_accounts_cb (TpProxy *proxy,
                        const GValue *out_Value,
                        const GError *error,
============================================================
--- libpurple/protocols/telepathy/telepathy_client.c	74314b53478b58f23c644f00229632097ae564c6
+++ libpurple/protocols/telepathy/telepathy_client.c	7ff57978823261e028c63221b9104e71170a74eb
@@ -20,17 +20,16 @@
 
 #include "telepathy_client.h"
 
-#include <telepathy-glib/enums.h>
 #include <telepathy-glib/connection.h>
-#include <telepathy-glib/util.h>
 #include <telepathy-glib/dbus.h>
-#include <telepathy-glib/proxy-subclass.h>
 #include <telepathy-glib/gtypes.h>
 #include <telepathy-glib/defs.h>
 #include <telepathy-glib/svc-client.h>
 #include <telepathy-glib/svc-generic.h>
 #include <telepathy-glib/interfaces.h>
 
+#include "debug.h"
+
 #define CLIENT_BUS_NAME TP_CLIENT_BUS_NAME_BASE "prpl_telepathy"
 #define CLIENT_OBJECT_PATH TP_CLIENT_OBJECT_PATH_BASE "prpl_telepathy"
 
@@ -164,8 +163,6 @@ client_get_property (GObject *object,
 
 			g_value_take_boxed (value, filters);
 
-			g_value_set_boxed (value, filters);
-
 			break;
 		}
 
@@ -314,7 +311,6 @@ telepathy_client_handle_channels (TpSvcC
 	{
 		/* TODO: Put the channel in priv->channels */
 
-		/*
 		GValueArray *arr = g_ptr_array_index (channels, i);
 		const gchar *object_path;
 		GHashTable *properties;
@@ -322,6 +318,9 @@ telepathy_client_handle_channels (TpSvcC
 		object_path = g_value_get_boxed (g_value_array_get_nth (arr, 0));
 		properties = g_value_get_boxed (g_value_array_get_nth (arr, 1));
 
+		purple_debug_info("telepathy", "HandleChannels: %s\n", object_path);
+
+		/*
 		client_connection_new_channel_with_properties (client,
 			connection, object_path, properties);
 		*/
============================================================
--- libpurple/protocols/telepathy/telepathy_utils.c	defd73a448af2c5281a8dee74e2c3b39a521c4cd
+++ libpurple/protocols/telepathy/telepathy_utils.c	667ad36eeb59f2f3250820cbd808f503955c55dd
@@ -22,6 +22,23 @@
 
 #include "internal.h"
 
+#include "debug.h"
+
+void
+set_properties_cb (TpProxy *proxy,
+                   const GError *error,
+                   gpointer user_data,
+                   GObject *weak_object)
+{
+	if (error != NULL)
+	{
+		purple_debug_info("telepathy", "SetProperties error: %s\n", error->message);
+		return;
+	}
+
+	purple_debug_info("telepathy", "SetProperties succeeded!\n");
+}
+
 /* transform a telepathy parameter name into a user-friendly one */
 gchar*
 telepathy_transform_param_name(const gchar* param)
============================================================
--- libpurple/protocols/telepathy/telepathy_utils.h	988e9541ee7ba5c500712f565c3fb167c84189db
+++ libpurple/protocols/telepathy/telepathy_utils.h	f54462bcd9efe93ec240c28bc46317fd4dc2f059
@@ -69,6 +69,12 @@ static const StatusMapping statuses[] = 
 	{ 0, NULL, NULL}
 };
 
+void
+set_properties_cb (TpProxy *proxy,
+                   const GError *error,
+                   gpointer user_data,
+                   GObject *weak_object);
+
 gchar*
 telepathy_transform_param_name(const gchar* param);
 


More information about the Commits mailing list