diff libpurple/dbus-server.c @ 27291:3a0552df3379

Add auto-generated D-Bus signals introspection, though parameter names are not included at the moment. Closes #3243.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Sun, 05 Jul 2009 05:41:00 +0000
parents 2307f8124407
children 5ef119455f0d
line wrap: on
line diff
--- a/libpurple/dbus-server.c	Sun Jul 05 03:32:34 2009 +0000
+++ b/libpurple/dbus-server.c	Sun Jul 05 05:41:00 2009 +0000
@@ -421,6 +421,7 @@
 }
 
 #include "dbus-bindings.c"
+#include "dbus-signals.c"
 
 static gboolean
 purple_dbus_dispatch_cb(DBusConnection *connection,
@@ -489,6 +490,9 @@
 	DBusMessage *reply;
 	GString *str;
 	GList *bindings_list, *node;
+	const char *signals;
+	const char *type;
+	const char *pointer_type;
 
 	str = g_string_sized_new(0x1000); /* TODO: why this size? */
 
@@ -529,6 +533,19 @@
 		}
 	}
 
+	if (sizeof(int) == sizeof(dbus_int32_t))
+		pointer_type = "type='i'";
+	else
+		pointer_type = "type='x'";
+
+	signals = dbus_signals;
+	while ((type = strstr(signals, "type='p'")) != NULL) {
+		g_string_append_len(str, signals, type - signals);
+		g_string_append(str, pointer_type);
+		signals = type + sizeof("type='p'") - 1;
+	}
+	g_string_append(str, signals);
+
 	g_string_append(str, "</interface>\n</node>\n");
 
 	reply = dbus_message_new_method_return(message);