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 --- test/test-service.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'test/test-service.c') diff --git a/test/test-service.c b/test/test-service.c index c2757acc..0771f33c 100644 --- a/test/test-service.c +++ b/test/test-service.c @@ -37,9 +37,9 @@ handle_echo (DBusConnection *connection, DBUS_TYPE_STRING, &s, DBUS_TYPE_INVALID)) { - reply = dbus_message_new_error_reply (message, - error.name, - error.message); + reply = dbus_message_new_error (message, + error.name, + error.message); if (reply == NULL) die ("No memory\n"); @@ -52,7 +52,7 @@ handle_echo (DBusConnection *connection, return DBUS_HANDLER_RESULT_ALLOW_MORE_HANDLERS; } - reply = dbus_message_new_reply (message); + reply = dbus_message_new_method_return (message); if (reply == NULL) die ("No memory\n"); @@ -99,11 +99,6 @@ main (int argc, DBusConnection *connection; DBusError error; DBusMessageHandler *handler; - const char *to_handle[] = { - "org.freedesktop.DBus.TestSuiteEcho", - "org.freedesktop.DBus.TestSuiteExit", - DBUS_MESSAGE_LOCAL_DISCONNECT, - }; int result; dbus_error_init (&error); @@ -127,8 +122,7 @@ main (int argc, if (handler == NULL) die ("No memory"); - if (!dbus_connection_register_handler (connection, handler, to_handle, - _DBUS_N_ELEMENTS (to_handle))) + if (!dbus_connection_add_filter (connection, handler)) die ("No memory"); result = dbus_bus_acquire_service (connection, "org.freedesktop.DBus.TestSuiteEchoService", -- 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. --- test/test-service.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'test/test-service.c') diff --git a/test/test-service.c b/test/test-service.c index 0771f33c..fffe4187 100644 --- a/test/test-service.c +++ b/test/test-service.c @@ -49,7 +49,7 @@ handle_echo (DBusConnection *connection, dbus_message_unref (reply); - return DBUS_HANDLER_RESULT_ALLOW_MORE_HANDLERS; + return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; } reply = dbus_message_new_method_return (message); @@ -68,7 +68,7 @@ handle_echo (DBusConnection *connection, dbus_message_unref (reply); - return DBUS_HANDLER_RESULT_ALLOW_MORE_HANDLERS; + return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; } static DBusHandlerResult @@ -84,11 +84,11 @@ filter_func (DBusMessageHandler *handler, { dbus_connection_disconnect (connection); quit (); - return DBUS_HANDLER_RESULT_ALLOW_MORE_HANDLERS; + return DBUS_HANDLER_RESULT_HANDLED; } else { - return DBUS_HANDLER_RESULT_ALLOW_MORE_HANDLERS; + return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; } } -- 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" --- test/test-service.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'test/test-service.c') diff --git a/test/test-service.c b/test/test-service.c index fffe4187..533f94ae 100644 --- a/test/test-service.c +++ b/test/test-service.c @@ -77,10 +77,16 @@ filter_func (DBusMessageHandler *handler, DBusMessage *message, void *user_data) { - if (dbus_message_has_name (message, "org.freedesktop.DBus.TestSuiteEcho")) + if (dbus_message_is_method_call (message, + "org.freedesktop.TestSuite", + "Echo")) return handle_echo (connection, message); - else if (dbus_message_has_name (message, "org.freedesktop.DBus.TestSuiteExit") || - dbus_message_has_name (message, DBUS_MESSAGE_LOCAL_DISCONNECT)) + else if (dbus_message_is_method_call (message, + "org.freedesktop.TestSuite", + "Exit") || + dbus_message_is_signal (message, + DBUS_INTERFACE_ORG_FREEDESKTOP_LOCAL, + "Disconnected")) { dbus_connection_disconnect (connection); quit (); -- 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 --- test/test-service.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'test/test-service.c') diff --git a/test/test-service.c b/test/test-service.c index 533f94ae..f22b1753 100644 --- a/test/test-service.c +++ b/test/test-service.c @@ -72,8 +72,7 @@ handle_echo (DBusConnection *connection, } static DBusHandlerResult -filter_func (DBusMessageHandler *handler, - DBusConnection *connection, +filter_func (DBusConnection *connection, DBusMessage *message, void *user_data) { @@ -104,7 +103,6 @@ main (int argc, { DBusConnection *connection; DBusError error; - DBusMessageHandler *handler; int result; dbus_error_init (&error); @@ -124,11 +122,8 @@ main (int argc, if (!test_connection_setup (loop, connection)) die ("No memory\n"); - handler = dbus_message_handler_new (filter_func, NULL, NULL); - if (handler == NULL) - die ("No memory"); - - if (!dbus_connection_add_filter (connection, handler)) + if (!dbus_connection_add_filter (connection, + filter_func, NULL, NULL)) die ("No memory"); result = dbus_bus_acquire_service (connection, "org.freedesktop.DBus.TestSuiteEchoService", @@ -145,10 +140,10 @@ main (int argc, _dbus_loop_run (loop); test_connection_shutdown (loop, connection); + + dbus_connection_remove_filter (connection, filter_func, NULL); dbus_connection_unref (connection); - - dbus_message_handler_unref (handler); _dbus_loop_unref (loop); loop = NULL; -- cgit From f4cffc0e49d48a8dbf158230d7e816d8713566da Mon Sep 17 00:00:00 2001 From: Seth Nickell Date: Mon, 22 Sep 2003 05:45:59 +0000 Subject: 2003-09-21 Seth Nickell First checkin of the Python bindings. * python/.cvsignore: * python/Makefile.am: * python/dbus_bindings.pyx.in: * python/dbus_h_wrapper.h: Pieces for Pyrex to operate on, building a dbus_bindings.so python module for low-level access to the DBus APIs. * python/dbus.py: High-level Python module for accessing DBus objects. * configure.in: * Makefile.am: Build stuff for the python bindings. * acinclude.m4: Extra macro needed for finding the Python C header files. --- test/test-service.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'test/test-service.c') diff --git a/test/test-service.c b/test/test-service.c index f22b1753..d07575e2 100644 --- a/test/test-service.c +++ b/test/test-service.c @@ -106,7 +106,7 @@ main (int argc, int result; dbus_error_init (&error); - connection = dbus_bus_get (DBUS_BUS_ACTIVATION, &error); + connection = dbus_bus_get (DBUS_BUS_SESSION, &error); if (connection == NULL) { _dbus_verbose ("*** Failed to open connection to activating message bus: %s\n", @@ -126,10 +126,13 @@ main (int argc, filter_func, NULL, NULL)) die ("No memory"); + printf ("Acquiring service\n"); + result = dbus_bus_acquire_service (connection, "org.freedesktop.DBus.TestSuiteEchoService", 0, &error); if (dbus_error_is_set (&error)) { + printf ("Error %s", error.message); _dbus_verbose ("*** Failed to acquire service: %s\n", error.message); dbus_error_free (&error); -- cgit