summaryrefslogtreecommitdiff
path: root/gdbus/object.c
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2012-12-18 05:09:59 +0100
committerMarcel Holtmann <marcel@holtmann.org>2012-12-19 03:43:28 +0100
commit3c64f4a395584c62db11ccc9a0ad9370eee2b70d (patch)
tree667e77d6f65bac2a8d781dceb03cce4ec2460430 /gdbus/object.c
parente659f5753cdb445cb0cfd3f56a3e0144d1c902c4 (diff)
downloadneard-3c64f4a395584c62db11ccc9a0ad9370eee2b70d.tar.gz
neard-3c64f4a395584c62db11ccc9a0ad9370eee2b70d.tar.bz2
neard-3c64f4a395584c62db11ccc9a0ad9370eee2b70d.zip
gdbus: Add helper for sending async error replies
Diffstat (limited to 'gdbus/object.c')
-rw-r--r--gdbus/object.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/gdbus/object.c b/gdbus/object.c
index 7cbd612..776d35e 100644
--- a/gdbus/object.c
+++ b/gdbus/object.c
@@ -1446,6 +1446,38 @@ gboolean g_dbus_send_message(DBusConnection *connection, DBusMessage *message)
return result;
}
+gboolean g_dbus_send_error_valist(DBusConnection *connection,
+ DBusMessage *message, const char *name,
+ const char *format, va_list args)
+{
+ DBusMessage *error;
+ char str[1024];
+
+ vsnprintf(str, sizeof(str), format, args);
+
+ error = dbus_message_new_error(message, name, str);
+ if (error == NULL)
+ return FALSE;
+
+ return g_dbus_send_message(connection, error);
+}
+
+gboolean g_dbus_send_error(DBusConnection *connection, DBusMessage *message,
+ const char *name, const char *format, ...)
+{
+ va_list args;
+ gboolean result;
+
+ va_start(args, format);
+
+ result = g_dbus_send_error_valist(connection, message, name,
+ format, args);
+
+ va_end(args);
+
+ return result;
+}
+
gboolean g_dbus_send_reply_valist(DBusConnection *connection,
DBusMessage *message, int type, va_list args)
{