summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b3e35ee)
raw | patch | inline | side by side (parent: b3e35ee)
author | Max Kellermann <max@duempel.org> | |
Wed, 17 Sep 2008 23:14:00 +0000 (01:14 +0200) | ||
committer | Max Kellermann <max@duempel.org> | |
Wed, 17 Sep 2008 23:14:00 +0000 (01:14 +0200) |
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.
screen_client_cmd(). This will allow us to unify error handling
later.
src/screen.c | patch | blob | history |
diff --git a/src/screen.c b/src/screen.c
index b6e2b7b79cc2c846192642902329391619f6f905..14ffffe6b5828dff9bf4177ad58945bc5cd27925 100644 (file)
--- a/src/screen.c
+++ b/src/screen.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);
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 ?