From b29ea9115ea3277354b7ccbe442026279220f4ac Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Mon, 11 Aug 2003 02:11:58 +0000 Subject: 2003-08-10 Havoc Pennington * tools/dbus-send.c (main): add --type argument, for now supporting only method_call and signal types. * tools/dbus-print-message.c: print message type * dbus/dbus-connection.c (_dbus_connection_new_for_transport): init connection->objects * doc/dbus-specification.sgml: fix sgml * bus/*.c: port over to object-instance API changes * test/test-service.c: ditto * dbus/dbus-message.c (dbus_message_create_header): allow #NULL name, we will have to fix up the rest of the code to also handle this (dbus_message_new): generic message-creation call (set_string_field): allow appending name field --- bus/test.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'bus/test.c') diff --git a/bus/test.c b/bus/test.c index 30cbcd05..ca10422f 100644 --- a/bus/test.c +++ b/bus/test.c @@ -107,6 +107,10 @@ client_disconnect_handler (DBusMessageHandler *handler, DBusMessage *message, void *user_data) { + if (!dbus_message_has_name (message, + DBUS_MESSAGE_LOCAL_DISCONNECT)) + return DBUS_HANDLER_RESULT_ALLOW_MORE_HANDLERS; + _dbus_verbose ("Removing client %p in disconnect handler\n", connection); @@ -138,7 +142,6 @@ dbus_bool_t bus_setup_debug_client (DBusConnection *connection) { DBusMessageHandler *disconnect_handler; - const char *to_handle[] = { DBUS_MESSAGE_LOCAL_DISCONNECT }; dbus_bool_t retval; disconnect_handler = dbus_message_handler_new (client_disconnect_handler, @@ -147,10 +150,8 @@ bus_setup_debug_client (DBusConnection *connection) if (disconnect_handler == NULL) return FALSE; - if (!dbus_connection_register_handler (connection, - disconnect_handler, - to_handle, - _DBUS_N_ELEMENTS (to_handle))) + if (!dbus_connection_add_filter (connection, + disconnect_handler)) { dbus_message_handler_unref (disconnect_handler); return FALSE; -- cgit From 5c1a8e44903bd1dedc8cbefad78b0c8b61daada5 Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Tue, 12 Aug 2003 02:43:50 +0000 Subject: 2003-08-11 Havoc Pennington * bus/test.c (client_disconnect_handler): change to return HANDLED (would have been REMOVE_MESSAGE) * dbus/dbus-object.h (enum DBusHandlerResult): rename to HANDLED/NOT_YET_HANDLED instead of REMOVE_MESSAGE/ALLOW_MORE_HANDLERS to make it clearer how it should be used. --- bus/test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'bus/test.c') diff --git a/bus/test.c b/bus/test.c index ca10422f..d28d7edf 100644 --- a/bus/test.c +++ b/bus/test.c @@ -109,7 +109,7 @@ client_disconnect_handler (DBusMessageHandler *handler, { if (!dbus_message_has_name (message, DBUS_MESSAGE_LOCAL_DISCONNECT)) - return DBUS_HANDLER_RESULT_ALLOW_MORE_HANDLERS; + return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; _dbus_verbose ("Removing client %p in disconnect handler\n", connection); @@ -124,7 +124,7 @@ client_disconnect_handler (DBusMessageHandler *handler, client_loop = NULL; } - return DBUS_HANDLER_RESULT_ALLOW_MORE_HANDLERS; + return DBUS_HANDLER_RESULT_HANDLED; } static dbus_int32_t handler_slot = -1; -- cgit From 68a3c593b9e77b33614726363c7b6fd85d113021 Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Mon, 18 Aug 2003 22:43:30 +0000 Subject: 2003-08-18 Havoc Pennington * dbus/dbus-hash.c (_dbus_hash_table_insert_two_strings): fix * dbus/dbus-message.c (_dbus_message_loader_queue_messages): fix dumb bug created earlier (wrong order of args to decode_header_data()) * tools/dbus-send.c: port * tools/dbus-print-message.c (print_message): port * test/data/*messages: port all messages over * dbus/dbus-message-builder.c: support including message type * bus/driver.c: port over * bus/dispatch.c: port over to new stuff * dbus/dbus-connection.c (_dbus_connection_new_for_transport): rename disconnect signal to "Disconnected" --- bus/test.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'bus/test.c') diff --git a/bus/test.c b/bus/test.c index d28d7edf..1f13e4b6 100644 --- a/bus/test.c +++ b/bus/test.c @@ -107,8 +107,9 @@ client_disconnect_handler (DBusMessageHandler *handler, DBusMessage *message, void *user_data) { - if (!dbus_message_has_name (message, - DBUS_MESSAGE_LOCAL_DISCONNECT)) + if (!dbus_message_is_signal (message, + DBUS_INTERFACE_ORG_FREEDESKTOP_LOCAL, + "Disconnected")) return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; _dbus_verbose ("Removing client %p in disconnect handler\n", -- cgit From 1dd3f1788f1b4c9af2f4fa744abdb7892d0a14b9 Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Sun, 31 Aug 2003 03:25:24 +0000 Subject: 2003-08-30 Havoc Pennington * dbus/dbus-connection.c: purge DBusMessageHandler * dbus/dbus-message-handler.c: remove DBusMessageHandler, just use callbacks everywhere --- bus/test.c | 51 ++++++++++----------------------------------------- 1 file changed, 10 insertions(+), 41 deletions(-) (limited to 'bus/test.c') diff --git a/bus/test.c b/bus/test.c index 1f13e4b6..b48ba0fe 100644 --- a/bus/test.c +++ b/bus/test.c @@ -102,10 +102,9 @@ remove_client_timeout (DBusTimeout *timeout, } static DBusHandlerResult -client_disconnect_handler (DBusMessageHandler *handler, - DBusConnection *connection, - DBusMessage *message, - void *user_data) +client_disconnect_filter (DBusConnection *connection, + DBusMessage *message, + void *user_data) { if (!dbus_message_is_signal (message, DBUS_INTERFACE_ORG_FREEDESKTOP_LOCAL, @@ -128,35 +127,15 @@ client_disconnect_handler (DBusMessageHandler *handler, return DBUS_HANDLER_RESULT_HANDLED; } -static dbus_int32_t handler_slot = -1; - -static void -free_handler (void *data) -{ - DBusMessageHandler *handler = data; - - dbus_message_handler_unref (handler); - dbus_connection_free_data_slot (&handler_slot); -} - dbus_bool_t bus_setup_debug_client (DBusConnection *connection) { - DBusMessageHandler *disconnect_handler; - dbus_bool_t retval; - - disconnect_handler = dbus_message_handler_new (client_disconnect_handler, - NULL, NULL); - - if (disconnect_handler == NULL) - return FALSE; + dbus_bool_t retval; if (!dbus_connection_add_filter (connection, - disconnect_handler)) - { - dbus_message_handler_unref (disconnect_handler); - return FALSE; - } + client_disconnect_filter, + NULL, NULL)) + return FALSE; retval = FALSE; @@ -184,25 +163,15 @@ bus_setup_debug_client (DBusConnection *connection) if (!_dbus_list_append (&clients, connection)) goto out; - - if (!dbus_connection_allocate_data_slot (&handler_slot)) - goto out; - - /* Set up handler to be destroyed */ - if (!dbus_connection_set_data (connection, handler_slot, - disconnect_handler, - free_handler)) - { - dbus_connection_free_data_slot (&handler_slot); - goto out; - } retval = TRUE; out: if (!retval) { - dbus_message_handler_unref (disconnect_handler); /* unregisters it */ + dbus_connection_remove_filter (connection, + client_disconnect_filter, + NULL); dbus_connection_set_watch_functions (connection, NULL, NULL, NULL, NULL, NULL); -- cgit