+ GString *output;
+ gchar *final;
+ gint i;
+
+ DBusMessage *reply;
+
+ _DROUTE_DEBUG ("DRoute (handle introspection): %s\n", pathstr);
+
+ if (g_strcmp0 (member, "Introspect"))
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+ output = g_string_new(introspection_header);
+
+ g_string_append_printf(output, introspection_node_element, pathstr);
+
+ for (i=0; i < path->introspection->len; i++)
+ {
+ gchar *introspect = (gchar *) g_ptr_array_index (path->introspection, i);
+ g_string_append (output, introspect);
+ }
+
+ g_string_append(output, introspection_footer);
+ final = g_string_free(output, FALSE);
+
+ reply = dbus_message_new_method_return (message);
+ if (!reply)
+ oom ();
+ dbus_message_append_args(reply, DBUS_TYPE_STRING, &final,
+ DBUS_TYPE_INVALID);
+ dbus_connection_send (bus, reply, NULL);
+
+ dbus_message_unref (reply);
+ g_free(final);
+ return DBUS_HANDLER_RESULT_HANDLED;
+}
+
+/*---------------------------------------------------------------------------*/
+
+static DBusHandlerResult
+handle_other (DBusConnection *bus,
+ DBusMessage *message,
+ DRoutePath *path,
+ const gchar *iface,
+ const gchar *member,
+ const gchar *pathstr)
+{
+ gint result = DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+ StrPair pair;
+ DRouteFunction func;
+ DBusMessage *reply = NULL;
+
+ void *datum;
+
+ pair.one = iface;
+ pair.two = member;
+
+ _DROUTE_DEBUG ("DRoute (handle other): %s|%s on %s\n", member, iface, pathstr);
+
+ func = (DRouteFunction) g_hash_table_lookup (path->methods, &pair);
+ if (func != NULL)
+ {
+ datum = path_get_datum (path, pathstr);
+ if (!datum)
+ reply = droute_object_does_not_exist_error (message);
+ else
+ reply = (func) (bus, message, datum);
+
+ if (!reply)
+ {
+ /* All D-Bus method calls must have a reply.
+ * If one is not provided presume that the call has a void
+ * return and no error has occured.
+ */
+ reply = dbus_message_new_method_return (message);
+ }
+ dbus_connection_send (bus, reply, NULL);
+ dbus_message_unref (reply);
+ result = DBUS_HANDLER_RESULT_HANDLED;
+ }
+
+ _DROUTE_DEBUG ("DRoute (handle other) (reply): type %d\n",
+ dbus_message_get_type(reply));
+ return result;