diff options
author | Max Kellermann <max@duempel.org> | 2008-09-18 01:14:00 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2008-09-18 01:14:00 +0200 |
commit | 9de9dfc3a6a8061089eebcc6271b2f13ac43e20b (patch) | |
tree | 55283464302e443cfdbfc0c14580151d363cbaa2 /src/screen.c | |
parent | b3e35ee16d6e5cb8e0f53c318c47b55c2dc9ba62 (diff) | |
download | mpd-9de9dfc3a6a8061089eebcc6271b2f13ac43e20b.tar.gz mpd-9de9dfc3a6a8061089eebcc6271b2f13ac43e20b.tar.xz mpd-9de9dfc3a6a8061089eebcc6271b2f13ac43e20b.zip |
screen: moved code to screen_client_cmd()
Move all command handlers which need a connection to the MPD server to
screen_client_cmd(). This will allow us to unify error handling
later.
Diffstat (limited to 'src/screen.c')
-rw-r--r-- | src/screen.c | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/src/screen.c b/src/screen.c index b6e2b7b79..14ffffe6b 100644 --- a/src/screen.c +++ b/src/screen.c @@ -795,16 +795,9 @@ screen_get_mouse_event(mpdclient_t *c, } #endif -void -screen_cmd(mpdclient_t *c, command_t cmd) +static int +screen_client_cmd(mpdclient_t *c, command_t cmd) { - screen.input_timestamp = time(NULL); - screen.last_cmd = cmd; - welcome = FALSE; - - if (mode_fn->cmd != NULL && mode_fn->cmd(&screen, c, cmd)) - return; - switch(cmd) { case CMD_PLAY: mpdclient_cmd_play(c, MPD_PLAY_AT_BEGINNING); @@ -883,6 +876,28 @@ screen_cmd(mpdclient_t *c, command_t cmd) if( c->status->volume!=MPD_STATUS_NO_VOLUME && c->status->volume>0 ) mpdclient_cmd_volume(c, --c->status->volume); break; + + default: + return 0; + } + + return 1; +} + +void +screen_cmd(mpdclient_t *c, command_t cmd) +{ + screen.input_timestamp = time(NULL); + screen.last_cmd = cmd; + welcome = FALSE; + + if (mode_fn->cmd != NULL && mode_fn->cmd(&screen, c, cmd)) + return; + + if (screen_client_cmd(c, cmd)) + return; + + switch(cmd) { case CMD_TOGGLE_FIND_WRAP: options.find_wrap = !options.find_wrap; screen_status_printf(options.find_wrap ? |