soc.2009.telepathy: 667b5e80: Client.Handler code finally compiles, no...

sttwister at soc.pidgin.im sttwister at soc.pidgin.im
Wed Jul 22 12:25:49 EDT 2009


-----------------------------------------------------------------
Revision: 667b5e8081964880be78106efeeb1d79a3648ee3
Ancestor: 418e04cd4c14b4f19f8bee2ef2a4a0aa9f393201
Author: sttwister at soc.pidgin.im
Date: 2009-07-22T16:21:29
Branch: im.pidgin.soc.2009.telepathy
URL: http://d.pidgin.im/viewmtn/revision/info/667b5e8081964880be78106efeeb1d79a3648ee3

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

ChangeLog: 

Client.Handler code finally compiles, no warnings either :)

-------------- next part --------------
============================================================
--- libpurple/protocols/telepathy/telepathy_client.c	c05e95ebe8627706fb2c6cd844665c6211a25194
+++ libpurple/protocols/telepathy/telepathy_client.c	74314b53478b58f23c644f00229632097ae564c6
@@ -34,8 +34,7 @@
 #define CLIENT_BUS_NAME TP_CLIENT_BUS_NAME_BASE "prpl_telepathy"
 #define CLIENT_OBJECT_PATH TP_CLIENT_OBJECT_PATH_BASE "prpl_telepathy"
 
-#define TELEPATHY_GET_PRIV(obj,type) ((type##Priv *) ((type *) obj)->priv)
-#define GET_PRIV(obj) TELEPATHY_GET_PRIV (obj, TelepathyClient)
+#define TELEPATHY_ARRAY_TYPE_OBJECT (telepathy_type_dbus_ao ())
 
 typedef struct
 {
@@ -44,6 +43,18 @@ typedef struct
 
 } TelepathyClientPriv;
 
+struct _TelepathyClient
+{
+	GObject parent;
+	TelepathyClientPriv *priv;
+};
+
+struct _TelepathyClientClass
+{
+	GObjectClass parent_class;
+	TpDBusPropertiesMixinClass dbus_props_class;
+};
+
 static void telepathy_client_client_handler_iface_init (gpointer g_iface,
 	gpointer g_iface_data);
 
@@ -101,9 +112,21 @@ static void
 }
 
 static void
+client_dispose (GObject *object)
+{
+	/* TODO: Close all channels */
+	/*
+	TelepathyClientPriv *priv = GET_PRIV (object);
+	*/
+
+}
+
+static void
 client_finalize (GObject *object)
 {
-	//TelepathyClientPriv *priv = GET_PRIV (object);
+	/*
+	TelepathyClientPriv *priv = GET_PRIV (object);
+	*/
 
 }
 
@@ -114,7 +137,7 @@ client_get_property (GObject *object,
                      GParamSpec *pspec)
 {
 	TelepathyClient *client = TELEPATHY_CLIENT (object);
-	TelepathyClientPriv *priv = GET_PRIV (client);
+	TelepathyClientPriv *priv = client->priv;
 
 	switch (property_id)
 	{
@@ -125,10 +148,22 @@ client_get_property (GObject *object,
 		case PROP_CHANNEL_FILTER:
 		{
 			GPtrArray *filters = g_ptr_array_new ();
-			GHashTable *filter = g_hash_table_new (NULL, NULL);
+			GHashTable *filter;
 
+			filter = tp_asv_new (
+				TP_IFACE_CHANNEL ".Type", G_TYPE_STRING, TP_IFACE_CHANNEL_TYPE_TEXT,
+				TP_IFACE_CHANNEL ".TargetHandleType", G_TYPE_UINT, TP_HANDLE_TYPE_CONTACT,
+				NULL);
 			g_ptr_array_add (filters, filter);
 
+			filter = tp_asv_new (
+				TP_IFACE_CHANNEL ".Type", G_TYPE_STRING, TP_IFACE_CHANNEL_TYPE_TEXT,
+				TP_IFACE_CHANNEL ".TargetHandleType", G_TYPE_UINT, TP_HANDLE_TYPE_ROOM,
+				NULL);
+			g_ptr_array_add (filters, filter);
+
+			g_value_take_boxed (value, filters);
+
 			g_value_set_boxed (value, filters);
 
 			break;
@@ -160,6 +195,17 @@ client_get_property (GObject *object,
 	}
 }
 
+static GType
+telepathy_type_dbus_ao (void)
+{
+  static GType t = 0;
+
+  if (G_UNLIKELY (t == 0))
+     t = dbus_g_type_get_collection ("GPtrArray", DBUS_TYPE_G_OBJECT_PATH);
+
+  return t;
+}
+
 static void
 telepathy_client_class_init (TelepathyClientClass *klass)
 {
@@ -167,29 +213,38 @@ telepathy_client_class_init (TelepathyCl
 	GParamSpec *param_spec;
 
 	static TpDBusPropertiesMixinPropImpl client_props[] = {
-		{ "Interfaces", "interfaces", NULL },
-		{ NULL }
+		{ "Interfaces", "interfaces", NULL, NULL, NULL, NULL },
+		{ NULL, NULL, NULL, NULL, NULL, NULL  }
 	};
 	static TpDBusPropertiesMixinPropImpl client_handler_props[] = {
-		{ "HandlerChannelFilter", "channel-filter", NULL },
-		{ "HandledChannels", "channels", NULL },
-		{ NULL }
+		{ "HandlerChannelFilter", "channel-filter", NULL, NULL, NULL, NULL },
+		{ "HandledChannels", "channels", NULL, NULL, NULL, NULL },
+		{ NULL, NULL, NULL, NULL, NULL, NULL }
 	};
 
 	static TpDBusPropertiesMixinIfaceImpl prop_interfaces[] = {
 		{ TP_IFACE_CLIENT,
 			tp_dbus_properties_mixin_getter_gobject_properties,
 			NULL,
-			client_props
+			client_props,
+			NULL,
+			NULL,
+			{ NULL },
+			NULL
 		},
 		{ TP_IFACE_CLIENT_HANDLER,
 			tp_dbus_properties_mixin_getter_gobject_properties,
 			NULL,
-			client_handler_props
+			client_handler_props,
+			NULL,
+			NULL,
+			{ NULL },
+			NULL
 		},
-		{ NULL }
+		{ NULL, NULL, NULL, NULL, NULL, NULL, { NULL }, NULL }
 	};
 
+	object_class->dispose = client_dispose;
 	object_class->finalize = client_finalize;
 	object_class->constructor = client_constructor;
 
@@ -226,16 +281,16 @@ telepathy_client_init (TelepathyClient *
 static void
 telepathy_client_init (TelepathyClient *client)
 {
-  TelepathyClientPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (client,
-    TELEPATHY_TYPE_CLIENT, TelepathyClientPriv);
+	TelepathyClientPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (client,
+		TELEPATHY_TYPE_CLIENT, TelepathyClientPriv);
 
-  client->priv = priv;
+	client->priv = priv;
 }
 
 TelepathyClient *
 telepathy_client_dup_singleton (void)
 {
-  return TELEPATHY_CLIENT (g_object_new (TELEPATHY_TYPE_CLIENT, NULL));
+	return TELEPATHY_CLIENT (g_object_new (TELEPATHY_TYPE_CLIENT, NULL));
 }
 
 static void
@@ -248,14 +303,16 @@ telepathy_client_handle_channels (TpSvcC
                                   GHashTable *handler_info,
                                   DBusGMethodInvocation *context)
 {
+	/*
 	TelepathyClient *client = TELEPATHY_CLIENT (self);
-	TelepathyClientPriv *priv = GET_PRIV (client);
+	TelepathyClientPriv *priv = client->priv;
+	*/
 
 	int i;
 
 	for (i = 0; i < channels->len ; i++)
 	{
-		/* TODO: Try to do something here! */
+		/* TODO: Put the channel in priv->channels */
 
 		/*
 		GValueArray *arr = g_ptr_array_index (channels, i);
============================================================
--- libpurple/protocols/telepathy/telepathy_client.h	37bc86e7cc391e3a578adda0a9e920ec89fe3bcf
+++ libpurple/protocols/telepathy/telepathy_client.h	8ea6ad2f45e07ad4a8fe6493d838d421f61ddec9
@@ -33,21 +33,9 @@
 #define TELEPATHY_IS_CLIENT_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), TELEPATHY_TYPE_CLIENT))
 #define TELEPATHY_CLIENT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TELEPATHY_TYPE_CLIENT, TelepathyClientClass))
 
-//typedef struct _TelepathyClient      TelepathyClient;
-//typedef struct _TelepathyClientClass TelepathyClientClass;
+typedef struct _TelepathyClient      TelepathyClient;
+typedef struct _TelepathyClientClass TelepathyClientClass;
 
-typedef struct 
-{
-	GObject parent;
-	gpointer priv;
-} TelepathyClient;
-
-typedef struct 
-{
-	GObjectClass parent_class;
-	TpDBusPropertiesMixinClass dbus_props_class;
-} TelepathyClientClass;
-
 GType telepathy_client_get_type (void) G_GNUC_CONST;
 
 TelepathyClient *    telepathy_client_dup_singleton (void);


More information about the Commits mailing list