summaryrefslogtreecommitdiffstats
path: root/dbus/dbus-message.c
diff options
context:
space:
mode:
authorOwen Fraser-Green <owen@discobabe.net>2004-03-23 18:07:48 +0000
committerOwen Fraser-Green <owen@discobabe.net>2004-03-23 18:07:48 +0000
commit632d54e0dbf5e405258be7afffbaa48942c06cbc (patch)
tree0b3495f8a0753d427078a90e585dc53a2287200d /dbus/dbus-message.c
parent0a673a8cd751d9eae14f3f5d0eeebf749b07bf09 (diff)
Added InterfaceProxy to Mono bindings to avoid having to generate a proxy for every registered object. Also added object_path functions to dbus-message.
Diffstat (limited to 'dbus/dbus-message.c')
-rw-r--r--dbus/dbus-message.c88
1 files changed, 72 insertions, 16 deletions
diff --git a/dbus/dbus-message.c b/dbus/dbus-message.c
index 6ae5a933..d56cd45d 100644
--- a/dbus/dbus-message.c
+++ b/dbus/dbus-message.c
@@ -1916,7 +1916,8 @@ dbus_message_append_args_valist (DBusMessage *message,
goto errorout;
break;
case DBUS_TYPE_OBJECT_PATH:
-
+ if (!dbus_message_iter_append_object_path (&iter, va_arg (var_args, const char*)))
+ goto errorout;
break;
case DBUS_TYPE_CUSTOM:
{
@@ -1977,6 +1978,10 @@ dbus_message_append_args_valist (DBusMessage *message,
if (!dbus_message_iter_append_string_array (&iter, (const char **)data, len))
goto errorout;
break;
+ case DBUS_TYPE_OBJECT_PATH:
+ if (!dbus_message_iter_append_object_path_array (&iter, (const char **)data, len))
+ goto errorout;
+ break;
case DBUS_TYPE_NIL:
case DBUS_TYPE_ARRAY:
case DBUS_TYPE_CUSTOM:
@@ -2664,7 +2669,6 @@ dbus_message_iter_get_string (DBusMessageIter *iter)
int type, pos;
_dbus_return_val_if_fail (dbus_message_iter_check (real), NULL);
-
pos = dbus_message_iter_get_data_start (real, &type);
_dbus_assert (type == DBUS_TYPE_STRING);
@@ -2673,11 +2677,7 @@ dbus_message_iter_get_string (DBusMessageIter *iter)
pos, NULL);
}
-#if 0
/**
- * @todo FIXME to finish this _dbus_demarshal_object_path() needs
- * to not explode the path.
- *
* Returns the object path value that an iterator may point to.
* Note that you need to check that the iterator points to
* an object path value before using this function.
@@ -2698,10 +2698,9 @@ dbus_message_iter_get_object_path (DBusMessageIter *iter)
_dbus_assert (type == DBUS_TYPE_OBJECT_PATH);
- return _dbus_demarshal_object_path (&real->message->body, real->message->byte_order,
- pos, NULL);
+ return _dbus_demarshal_string (&real->message->body, real->message->byte_order,
+ pos, NULL);
}
-#endif
/**
* Returns the name and data from a custom type that an iterator may
@@ -3325,11 +3324,7 @@ dbus_message_iter_get_string_array (DBusMessageIter *iter,
return TRUE;
}
-#if 0
/**
- * @todo FIXME to implement this _dbus_demarshal_object_path_array()
- * needs implementing
- *
* Returns the object path array that the iterator may point to.
* Note that you need to check that the iterator points
* to an object path array prior to using this function.
@@ -3361,13 +3356,12 @@ dbus_message_iter_get_object_path_array (DBusMessageIter *iter,
type = iter_get_array_type (real, NULL);
_dbus_assert (type == DBUS_TYPE_OBJECT_PATH);
- if (!_dbus_demarshal_object_path_array (&real->message->body, real->message->byte_order,
- pos, NULL, value, len))
+ if (!_dbus_demarshal_string_array (&real->message->body, real->message->byte_order,
+ pos, NULL, value, len))
return FALSE;
else
return TRUE;
}
-#endif
/**
* Returns the key name fot the dict entry that an iterator
@@ -3800,6 +3794,37 @@ dbus_message_iter_append_string (DBusMessageIter *iter,
}
/**
+ * Appends an object path to the message.
+ *
+ * @todo add return_val_if_fail(UTF-8 is valid)
+ *
+ * @param iter an iterator pointing to the end of the message
+ * @param value the object path
+ * @returns #TRUE on success
+ */
+dbus_bool_t
+dbus_message_iter_append_object_path (DBusMessageIter *iter,
+ const char *value)
+{
+ DBusMessageRealIter *real = (DBusMessageRealIter *)iter;
+
+ _dbus_return_val_if_fail (dbus_message_iter_append_check (real), FALSE);
+
+ if (!dbus_message_iter_append_type (real, DBUS_TYPE_OBJECT_PATH))
+ return FALSE;
+
+ if (!_dbus_marshal_string (&real->message->body, real->message->byte_order, value))
+ {
+ _dbus_string_set_length (&real->message->body, real->pos);
+ return FALSE;
+ }
+
+ dbus_message_iter_append_done (real);
+
+ return TRUE;
+}
+
+/**
* Appends a custom type data chunk to the message. A custom
* type is simply an arbitrary UTF-8 string used as a type
* tag, plus an array of arbitrary bytes to be interpreted
@@ -4331,6 +4356,37 @@ dbus_message_iter_append_string_array (DBusMessageIter *iter,
}
/**
+ * Appends an object path array to the message.
+ *
+ * @param iter an iterator pointing to the end of the message
+ * @param value the array
+ * @param len the length of the array
+ * @returns #TRUE on success
+ */
+dbus_bool_t
+dbus_message_iter_append_object_path_array (DBusMessageIter *iter,
+ const char **value,
+ int len)
+{
+ DBusMessageRealIter *real = (DBusMessageRealIter *)iter;
+
+ _dbus_return_val_if_fail (dbus_message_iter_append_check (real), FALSE);
+
+ if (!append_array_type (real, DBUS_TYPE_OBJECT_PATH, NULL, NULL))
+ return FALSE;
+
+ if (!_dbus_marshal_string_array (&real->message->body, real->message->byte_order, value, len))
+ {
+ _dbus_string_set_length (&real->message->body, real->pos);
+ return FALSE;
+ }
+
+ dbus_message_iter_append_done (real);
+
+ return TRUE;
+}
+
+/**
* Sets the message sender.
*
* @param message the message