From e9f1b53ae6819170ea06f4347a2c5c631044c1f3 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 6 Mar 2012 22:08:54 +0100 Subject: command, ack: add ack_quark() To pass ack values around. --- src/ack.h | 12 ++++++++++++ src/command.c | 4 ++++ 2 files changed, 16 insertions(+) diff --git a/src/ack.h b/src/ack.h index f86b605f7..440bc27d8 100644 --- a/src/ack.h +++ b/src/ack.h @@ -20,6 +20,8 @@ #ifndef MPD_ACK_H #define MPD_ACK_H +#include + enum ack { ACK_ERROR_NOT_LIST = 1, ACK_ERROR_ARG = 2, @@ -36,4 +38,14 @@ enum ack { ACK_ERROR_EXIST = 56, }; +/** + * Quark for GError.domain; the code is an enum #ack. + */ +G_GNUC_CONST +static inline GQuark +ack_quark(void) +{ + return g_quark_from_static_string("ack"); +} + #endif diff --git a/src/command.c b/src/command.c index 4641f671b..655ed7b1a 100644 --- a/src/command.c +++ b/src/command.c @@ -183,6 +183,10 @@ print_error(struct client *client, GError *error) enum playlist_result result = error->code; g_error_free(error); return print_playlist_result(client, result); + } else if (error->domain == ack_quark()) { + command_error(client, error->code, "%s", error->message); + g_error_free(error); + return COMMAND_RETURN_ERROR; } else if (error->domain == db_quark()) { switch ((enum db_error)error->code) { case DB_DISABLED: -- cgit v1.2.3