summaryrefslogtreecommitdiff
path: root/tools/dbus-print-message.c
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2003-08-11 02:11:58 +0000
committerHavoc Pennington <hp@redhat.com>2003-08-11 02:11:58 +0000
commitb29ea9115ea3277354b7ccbe442026279220f4ac (patch)
tree19e8a5880d7c324a7da4e712fdd76262470a54fe /tools/dbus-print-message.c
parentcefb84edc5f84011c5a171e5d052e37c56c55d27 (diff)
downloaddbus-b29ea9115ea3277354b7ccbe442026279220f4ac.tar.gz
2003-08-10 Havoc Pennington <hp@pobox.com>
* 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
Diffstat (limited to 'tools/dbus-print-message.c')
-rw-r--r--tools/dbus-print-message.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/tools/dbus-print-message.c b/tools/dbus-print-message.c
index bb380ce5..7c5328da 100644
--- a/tools/dbus-print-message.c
+++ b/tools/dbus-print-message.c
@@ -21,15 +21,36 @@
*/
#include "dbus-print-message.h"
+static const char*
+type_to_name (int message_type)
+{
+ switch (message_type)
+ {
+ case DBUS_MESSAGE_TYPE_SIGNAL:
+ return "signal";
+ case DBUS_MESSAGE_TYPE_METHOD_CALL:
+ return "method call";
+ case DBUS_MESSAGE_TYPE_METHOD_RETURN:
+ return "method return";
+ case DBUS_MESSAGE_TYPE_ERROR:
+ return "error";
+ default:
+ return "(unknown message type)";
+ }
+}
+
void
print_message (DBusMessage *message)
{
DBusMessageIter iter;
const char *sender;
+ int message_type;
+ message_type = dbus_message_get_type (message);
sender = dbus_message_get_sender (message);
- printf ("message name=%s; sender=%s\n",
+ printf ("%s name=%s; sender=%s\n",
+ type_to_name (message_type),
dbus_message_get_name (message),
sender ? sender : "(no sender)");