diff options
author | Havoc Pennington <hp@redhat.com> | 2005-01-30 07:44:08 +0000 |
---|---|---|
committer | Havoc Pennington <hp@redhat.com> | 2005-01-30 07:44:08 +0000 |
commit | 98ad8a8ec6626f7f5c78915b6bdf2be688b4839f (patch) | |
tree | fb2744289e2f187aa7239d11bf8473fd186fa1ce /tools/dbus-print-message.c | |
parent | 41f52c96d651003b3d0a266a582d401228a8368e (diff) | |
download | dbus-98ad8a8ec6626f7f5c78915b6bdf2be688b4839f.tar.gz |
2005-01-30 Havoc Pennington <hp@redhat.com>
* glib/dbus-gobject.c (introspect_properties): fix the XML
generated
* dbus/dbus-message.c (dbus_message_unref): add an in_cache flag
which effectively detects the use of freed messages
* glib/dbus-gobject.c (handle_introspect): modify and return the
reply message instead of the incoming message
* dbus/dbus-object-tree.c (handle_default_introspect_unlocked):
gee, maybe it should SEND THE XML instead of just making a string
and freeing it again ;-)
* tools/dbus-print-message.c (print_message): improve printing of
messages
* configure.in: add debug-glib.service to the output
Diffstat (limited to 'tools/dbus-print-message.c')
-rw-r--r-- | tools/dbus-print-message.c | 52 |
1 files changed, 28 insertions, 24 deletions
diff --git a/tools/dbus-print-message.c b/tools/dbus-print-message.c index 572a1d14..b3559256 100644 --- a/tools/dbus-print-message.c +++ b/tools/dbus-print-message.c @@ -44,43 +44,45 @@ print_message (DBusMessage *message) { DBusMessageIter iter; const char *sender; + const char *destination; int message_type; + int count; message_type = dbus_message_get_type (message); - sender = dbus_message_get_sender (message); - + sender = dbus_message_get_sender (message); + destination = dbus_message_get_destination (message); + + printf ("%s sender=%s -> dest=%s", + type_to_name (message_type), + sender ? sender : "(null sender)", + destination ? destination : "(null destination)"); + switch (message_type) { case DBUS_MESSAGE_TYPE_METHOD_CALL: case DBUS_MESSAGE_TYPE_SIGNAL: - printf ("%s interface=%s; member=%s; sender=%s\n", - type_to_name (message_type), + printf (" interface=%s; member=%s\n", dbus_message_get_interface (message), - dbus_message_get_member (message), - sender ? sender : "(no sender)"); + dbus_message_get_member (message)); break; case DBUS_MESSAGE_TYPE_METHOD_RETURN: - printf ("%s; sender=%s\n", - type_to_name (message_type), - sender ? sender : "(no sender)"); + printf ("\n"); break; case DBUS_MESSAGE_TYPE_ERROR: - printf ("%s name=%s; sender=%s\n", - type_to_name (message_type), - dbus_message_get_error_name (message), - sender ? sender : "(no sender)"); + printf (" error_name=%s\n", + dbus_message_get_error_name (message)); break; default: - printf ("Message of unknown type %d received\n", - message_type); + printf ("\n"); break; } - - dbus_message_iter_init (message, &iter); + dbus_message_iter_init (message, &iter); + count = 0; + do { int type = dbus_message_iter_get_arg_type (&iter); @@ -98,38 +100,40 @@ print_message (DBusMessage *message) { case DBUS_TYPE_STRING: dbus_message_iter_get_basic (&iter, &str); - printf ("string:%s\n", str); + printf (" %d string \"%s\"\n", count, str); break; case DBUS_TYPE_INT32: dbus_message_iter_get_basic (&iter, &int32); - printf ("int32:%d\n", int32); + printf (" %d int32 %d\n", count, int32); break; case DBUS_TYPE_UINT32: dbus_message_iter_get_basic (&iter, &uint32); - printf ("int32:%u\n", uint32); + printf (" %d uint32 %u\n", count, uint32); break; case DBUS_TYPE_DOUBLE: dbus_message_iter_get_basic (&iter, &d); - printf ("double:%f\n", d); + printf (" %d double %g\n", count, d); break; case DBUS_TYPE_BYTE: dbus_message_iter_get_basic (&iter, &byte); - printf ("byte:%d\n", byte); + printf (" %d byte %d\n", count, byte); break; case DBUS_TYPE_BOOLEAN: dbus_message_iter_get_basic (&iter, &boolean); - printf ("boolean:%s\n", boolean ? "true" : "false"); + printf (" %d boolean %s\n", count, boolean ? "true" : "false"); break; default: - printf ("(unknown arg type %d)\n", type); + printf (" (dbus-monitor too dumb to decipher arg type '%c')\n", type); break; } + + count += 1; } while (dbus_message_iter_next (&iter)); } |