char *str;
DBusMessage *reply;
GSList *l;
+ void *datum;
if (strcmp (dbus_message_get_member (message), "Introspect"))
{
xml = g_string_new (NULL);
/* below code stolen from dbus-glib */
g_string_append (xml, DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE);
+ g_string_append_printf (xml, "<node name=\"%s\">\n", path);
/* We are introspectable, though I guess that was pretty obvious */
g_string_append_printf (xml, " <interface name=\"%s\">\n",
g_string_append (xml, " </method>\n");
g_string_append (xml, " </interface>\n");
- g_string_append_printf (xml, "<node name=\"%s\">\n", path);
/* end of stolen code */
for (l = data->interfaces; l; l = g_slist_next (l))
{
iface_def = (DRouteInterface *) l->data;
- if (!(*iface_def->get_datum) (path, data->user_data))
+ datum = (*iface_def->get_datum) (path, data->user_data);
+ if (!datum)
continue;
g_string_append_printf (xml, "<interface name=\"%s\">\n",
iface_def->name);
(method->type ==
DROUTE_METHOD ? "method" : "signal"),
method->name);
- g_string_append (xml, "<arg type=\"");
- g_string_append_len (xml, p, strcspn (p, ",:"));
- p += strcspn (p, ",");
- if (*p == ',')
- p++;
- g_string_append (xml, "\" name=\"");
- g_string_append_len (xml, p, strcspn (p, ",:"));
- p += strcspn (p, ",");
- if (*p == ',')
- p++;
- g_string_append_printf (xml, "\" direction=\"%s\"/>\n",
- (*p == 'o' ? "out" : "in"));
- p += strcspn (p, ":");
- if (*p == ':')
- p++;
+ while (*p)
+ {
+ g_string_append (xml, "<arg type=\"");
+ g_string_append_len (xml, p, strcspn (p, ",:"));
+ p += strcspn (p, ",");
+ if (*p == ',')
+ p++;
+ if (strcspn (p, ",:") > 0)
+ {
+ g_string_append (xml, "\" name=\"");
+ g_string_append_len (xml, p, strcspn (p, ",:"));
+ p += strcspn (p, ",");
+ }
+ if (*p == ',')
+ p++;
+ g_string_append_printf (xml, "\" direction=\"%s\"/>\n",
+ (*p == 'o' ? "out" : "in"));
+ p += strcspn (p, ":");
+ if (*p == ':')
+ p++;
+ }
+ g_string_append_printf (xml, "</%s>\n",
+ (method->type ==
+ DROUTE_METHOD ? "method" : "signal"));
}
if (iface_def->properties)
for (property = iface_def->properties; property->name; property++)
(property->get ? "read" : ""),
(property->set ? "write" : ""));
}
+ if (iface_def->free_datum)
+ (*iface_def->free_datum) (datum);
+ g_string_append (xml, "</interface>\n");
+ }
+ if (data->introspect_children)
+ {
+ (*data->introspect_children) (path, xml, data->user_data);
}
- (*data->introspect_children) (path, xml, data->user_data);
+ g_string_append (xml, "</node>\n");
str = g_string_free (xml, FALSE);
reply = dbus_message_new_method_return (message);
if (reply)
dbus_error_init (&error);
if (!member)
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
- if (iface && !strcmp (iface, "org.freedesktop.dbus.Properties"))
+ if (iface && !strcmp (iface, "org.freedesktop.DBus.Properties"))
{
if (!strcmp (member, "GetAll"))
return prop_get_all (bus, message, data);
return prop (bus, message, data);
}
- else if (iface && !strcmp (iface, "org.freedesktop.dbus.Introspectable"))
+ else if (iface && !strcmp (iface, "org.freedesktop.DBus.Introspectable"))
{
return introspect (bus, message, data);
}