changeset 97211:194ecdbbd8a3

* dbusbind.c (xd_read_message): Handle D-Bus error messages.
author Michael Albinus <michael.albinus@gmx.de>
date Fri, 01 Aug 2008 18:35:10 +0000
parents 50d4090b5c35
children 557e6260f3d6
files src/dbusbind.c
diffstat 1 files changed, 20 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/src/dbusbind.c	Fri Aug 01 18:05:37 2008 +0000
+++ b/src/dbusbind.c	Fri Aug 01 18:35:10 2008 +0000
@@ -1436,29 +1436,32 @@
 
   /* Read message type, message serial, unique name, object path,
      interface and member from the message.  */
-  mtype     = dbus_message_get_type (dmessage);
-  serial    = (mtype == DBUS_MESSAGE_TYPE_METHOD_RETURN ?
-	       dbus_message_get_reply_serial (dmessage) :
-	       dbus_message_get_serial (dmessage));
-  uname     = dbus_message_get_sender (dmessage);
-  path      = dbus_message_get_path (dmessage);
+  mtype = dbus_message_get_type (dmessage);
+  serial =
+    ((mtype == DBUS_MESSAGE_TYPE_METHOD_RETURN)
+     || (mtype == DBUS_MESSAGE_TYPE_ERROR))
+    ? dbus_message_get_reply_serial (dmessage)
+    : dbus_message_get_serial (dmessage);
+  uname = dbus_message_get_sender (dmessage);
+  path = dbus_message_get_path (dmessage);
   interface = dbus_message_get_interface (dmessage);
-  member    = dbus_message_get_member (dmessage);
+  member = dbus_message_get_member (dmessage);
 
   XD_DEBUG_MESSAGE ("Event received: %s %d %s %s %s %s %s",
-		    (mtype == DBUS_MESSAGE_TYPE_INVALID) ?
-		    "DBUS_MESSAGE_TYPE_INVALID" :
-		    (mtype == DBUS_MESSAGE_TYPE_METHOD_CALL) ?
-		    "DBUS_MESSAGE_TYPE_METHOD_CALL" :
-		    (mtype == DBUS_MESSAGE_TYPE_METHOD_RETURN) ?
-		    "DBUS_MESSAGE_TYPE_METHOD_RETURN" :
-		    (mtype == DBUS_MESSAGE_TYPE_ERROR) ?
-		    "DBUS_MESSAGE_TYPE_METHOD_ERROR" :
-		    "DBUS_MESSAGE_TYPE_METHOD_SIGNAL",
+		    (mtype == DBUS_MESSAGE_TYPE_INVALID)
+		    ? "DBUS_MESSAGE_TYPE_INVALID"
+		    : (mtype == DBUS_MESSAGE_TYPE_METHOD_CALL)
+		    ? "DBUS_MESSAGE_TYPE_METHOD_CALL"
+		    : (mtype == DBUS_MESSAGE_TYPE_METHOD_RETURN)
+		    ? "DBUS_MESSAGE_TYPE_METHOD_RETURN"
+		    : (mtype == DBUS_MESSAGE_TYPE_ERROR)
+		    ? "DBUS_MESSAGE_TYPE_ERROR"
+		    : "DBUS_MESSAGE_TYPE_SIGNAL",
 		    serial, uname, path, interface, member,
 		    SDATA (format2 ("%s", args, Qnil)));
 
-  if (mtype == DBUS_MESSAGE_TYPE_METHOD_RETURN)
+  if ((mtype == DBUS_MESSAGE_TYPE_METHOD_RETURN)
+      || (mtype == DBUS_MESSAGE_TYPE_ERROR))
     {
       /* Search for a registered function of the message.  */
       key = list2 (bus, make_number (serial));