pidgin: bdca8e11: Fix dbus introspection. Fixes #13073.

rekkanoryo at pidgin.im rekkanoryo at pidgin.im
Sat Jan 8 10:55:51 EST 2011


----------------------------------------------------------------------
Revision: bdca8e1103c8ba5e56e72784f743212e91fc91ae
Parent:   de421565e6ea7c192ab1f57855335ea5ed75139b
Author:   pidgin at modtwo.com
Date:     01/08/11 10:19:00
Branch:   im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/bdca8e1103c8ba5e56e72784f743212e91fc91ae

Changelog: 

Fix dbus introspection.  Fixes #13073.

Changes against parent de421565e6ea7c192ab1f57855335ea5ed75139b

  patched  libpurple/dbus-analyze-signals.py
  patched  libpurple/dbus-server.c

-------------- next part --------------
============================================================
--- libpurple/dbus-server.c	780fddd1c413f86d05d1a6661e68b30ce09f23c5
+++ libpurple/dbus-server.c	2ba309612c9538f946061f6f8bab1e35d15816c6
@@ -501,8 +501,10 @@ static DBusMessage *purple_dbus_introspe
 
 	g_string_append(str, "<!DOCTYPE node PUBLIC '-//freedesktop//DTD D-BUS Object Introspection 1.0//EN' 'http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd'>\n");
 	g_string_append_printf(str, "<node name='%s'>\n", DBUS_PATH_PURPLE);
-	g_string_append_printf(str, "<interface name='%s'>\n", DBUS_INTERFACE_PURPLE);
+	g_string_append(str, "  <interface name='org.freedesktop.DBus.Introspectable'>\n    <method name='Introspect'>\n      <arg name='data' direction='out' type='s'/>\n    </method>\n  </interface>\n\n");
 
+	g_string_append_printf(str, "  <interface name='%s'>\n", DBUS_INTERFACE_PURPLE);
+
 	bindings_list = NULL;
 	purple_signal_emit(purple_dbus_get_handle(), "dbus-introspect", &bindings_list);
 
@@ -517,7 +519,7 @@ static DBusMessage *purple_dbus_introspe
 		{
 			const char *text;
 
-			g_string_append_printf(str, "<method name='%s'>\n", bindings[i].name);
+			g_string_append_printf(str, "    <method name='%s'>\n", bindings[i].name);
 
 			text = bindings[i].parameters;
 			while (*text)
@@ -529,10 +531,10 @@ static DBusMessage *purple_dbus_introspe
 				name = dbus_gettext(&text);
 
 				g_string_append_printf(str,
-						"<arg name='%s' type='%s' direction='%s'/>\n",
+						"      <arg name='%s' type='%s' direction='%s'/>\n",
 						name, type, direction);
 			}
-			g_string_append(str, "</method>\n");
+			g_string_append(str, "    </method>\n");
 		}
 	}
 
@@ -549,7 +551,7 @@ static DBusMessage *purple_dbus_introspe
 	}
 	g_string_append(str, signals);
 
-	g_string_append(str, "</interface>\n</node>\n");
+	g_string_append(str, "  </interface>\n</node>\n");
 
 	reply = dbus_message_new_method_return(message);
 	dbus_message_append_args(reply, DBUS_TYPE_STRING, &(str->str),
@@ -568,10 +570,8 @@ purple_dbus_dispatch(DBusConnection *con
 			"dbus-method-called", connection, message))
 		return DBUS_HANDLER_RESULT_HANDLED;
 
-	if (dbus_message_get_type(message) == DBUS_MESSAGE_TYPE_METHOD_CALL &&
-			dbus_message_has_path(message, DBUS_PATH_PURPLE) &&
-			dbus_message_has_interface(message, DBUS_INTERFACE_INTROSPECTABLE) &&
-			dbus_message_has_member(message, "Introspect"))
+	if (dbus_message_is_method_call(message, DBUS_INTERFACE_INTROSPECTABLE, "Introspect") &&
+			dbus_message_has_path(message, DBUS_PATH_PURPLE))
 	{
 		DBusMessage *reply;
 		reply = purple_dbus_introspect(message);
============================================================
--- libpurple/dbus-analyze-signals.py	ed35e2033a31a0403a4a374c8afe9692d900ab69
+++ libpurple/dbus-analyze-signals.py	09ab368fa4080cf053b7207a794b61fb7411c6ee
@@ -32,7 +32,7 @@ for match in registerregex.finditer(sys.
         continue
 
     signal = nameregex.sub(lambda x:x.group()[1].upper(), '-'+signal)
-    print "\"<signal name='%s'>\\n\""%signal
+    print "\"    <signal name='%s'>\\n\""%signal
 
     args = marshal.split('_')
     # ['purple', 'marshal', <return type>, '', args...]
@@ -52,9 +52,9 @@ for match in registerregex.finditer(sys.
                 type = 't'
             elif arg == "BOOLEAN":
                 type = 'b'
-            print "\"<arg type='%s'/>\\n\""%type
+            print "\"      <arg type='%s'/>\\n\""%type
 
-    print "\"</signal>\\n\""
+    print "\"    </signal>\\n\""
 
 print ";"
 


More information about the Commits mailing list