summaryrefslogtreecommitdiffstats
path: root/gdbus
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2008-05-27 08:50:36 +0000
committerMarcel Holtmann <marcel@holtmann.org>2008-05-27 08:50:36 +0000
commitaff0ec6707716c2ea129695f85715d59e3d9474b (patch)
tree3c92a9168198e1b86d7defd9a1bb906aafb5b209 /gdbus
parentaf6885a49f231d2e5fe421187679b27252658b6c (diff)
Add new message dispatching
Diffstat (limited to 'gdbus')
-rw-r--r--gdbus/object.c40
1 files changed, 39 insertions, 1 deletions
diff --git a/gdbus/object.c b/gdbus/object.c
index 24da21c9..6011753d 100644
--- a/gdbus/object.c
+++ b/gdbus/object.c
@@ -294,12 +294,13 @@ static DBusHandlerResult generic_message(DBusConnection *connection,
{
struct generic_data *data = user_data;
struct interface_data *iface;
+ GDBusMethodTable *method;
DBusMethodVTable *current;
const char *interface;
if (dbus_message_is_method_call(message,
DBUS_INTERFACE_INTROSPECTABLE,
- "Introspect"))
+ "Introspect"))
return introspect(connection, message, data);
interface = dbus_message_get_interface(message);
@@ -308,6 +309,43 @@ static DBusHandlerResult generic_message(DBusConnection *connection,
if (!iface)
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ for (method = iface->methods;
+ method->name && method->function; method++) {
+ DBusMessage *reply;
+
+ if (dbus_message_is_method_call(message, iface->name,
+ method->name) == FALSE)
+ continue;
+
+ if (dbus_message_has_signature(message,
+ method->signature) == FALSE)
+ continue;
+
+ if (method->function == NULL)
+ continue;
+
+ reply = method->function(connection, message, iface->user_data);
+
+ if (method->flags & G_DBUS_METHOD_FLAG_NOREPLY) {
+ if (reply != NULL)
+ dbus_message_unref(reply);
+ return DBUS_HANDLER_RESULT_HANDLED;
+ }
+
+ if (method->flags & G_DBUS_METHOD_FLAG_ASYNC) {
+ if (reply == NULL)
+ return DBUS_HANDLER_RESULT_HANDLED;
+ }
+
+ if (reply == NULL)
+ return DBUS_HANDLER_RESULT_NEED_MEMORY;
+
+ dbus_connection_send(connection, reply, NULL);
+ dbus_message_unref(reply);
+
+ return DBUS_HANDLER_RESULT_HANDLED;
+ }
+
for (current = iface->old_methods;
current->name && current->message_function; current++) {
if (!dbus_message_is_method_call(message, iface->name,