diff options
author | Max Kellermann <max@duempel.org> | 2009-07-29 08:00:01 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2009-07-29 08:00:01 +0200 |
commit | 6f060081be272d4a8b1bcf1ad0197de4ea5cd5e3 (patch) | |
tree | 1e74296a7dd107b9ecbac6153652d245e40ae19e /src/client_process.c | |
parent | 7f865f722c55dc7a2a27c7869030accc8ab9beb2 (diff) | |
download | mpd-6f060081be272d4a8b1bcf1ad0197de4ea5cd5e3.tar.gz mpd-6f060081be272d4a8b1bcf1ad0197de4ea5cd5e3.tar.xz mpd-6f060081be272d4a8b1bcf1ad0197de4ea5cd5e3.zip |
command: moved command_process_list() to client.c
Diffstat (limited to 'src/client_process.c')
-rw-r--r-- | src/client_process.c | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/src/client_process.c b/src/client_process.c index 5579b70ed..2f69cc6a8 100644 --- a/src/client_process.c +++ b/src/client_process.c @@ -25,6 +25,28 @@ #define CLIENT_LIST_OK_MODE_BEGIN "command_list_ok_begin" #define CLIENT_LIST_MODE_END "command_list_end" +static enum command_return +client_process_command_list(struct client *client, bool list_ok, GSList *list) +{ + enum command_return ret = COMMAND_RETURN_OK; + unsigned num = 0; + + for (GSList *cur = list; cur != NULL; cur = g_slist_next(cur)) { + char *cmd = cur->data; + + g_debug("command_process_list: process command \"%s\"", + cmd); + ret = command_process(client, num++, cmd); + g_debug("command_process_list: command returned %i", ret); + if (ret != COMMAND_RETURN_OK || client_is_expired(client)) + break; + else if (list_ok) + client_puts(client, "list_OK\n"); + } + + return ret; +} + enum command_return client_process_line(struct client *client, char *line) { @@ -61,9 +83,9 @@ client_process_line(struct client *client, char *line) to restore the correct order */ client->cmd_list = g_slist_reverse(client->cmd_list); - ret = command_process_list(client, - client->cmd_list_OK, - client->cmd_list); + ret = client_process_command_list(client, + client->cmd_list_OK, + client->cmd_list); g_debug("[%u] process command " "list returned %i", client->num, ret); @@ -104,7 +126,7 @@ client_process_line(struct client *client, char *line) } else { g_debug("[%u] process command \"%s\"", client->num, line); - ret = command_process(client, line); + ret = command_process(client, 0, line); g_debug("[%u] command returned %i", client->num, ret); |