summaryrefslogtreecommitdiff
path: root/svdrp.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2002-09-08 11:46:53 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2002-09-08 11:46:53 +0200
commit1b396902e488e093234ac181bbc0e514dd098942 (patch)
treecbd726e2b26c8280ac4ae4bdbae58c0b05ebae27 /svdrp.c
parentf47655ef0f1836be0d92a7fa57e3c300922a81ee (diff)
downloadvdr-1b396902e488e093234ac181bbc0e514dd098942.tar.gz
vdr-1b396902e488e093234ac181bbc0e514dd098942.tar.bz2
Skipping unavailable channels when switching with 'Up' and 'Down' keys
Diffstat (limited to 'svdrp.c')
-rw-r--r--svdrp.c31
1 files changed, 20 insertions, 11 deletions
diff --git a/svdrp.c b/svdrp.c
index c5a71cdb..3115349c 100644
--- a/svdrp.c
+++ b/svdrp.c
@@ -10,7 +10,7 @@
* and interact with the Video Disk Recorder - or write a full featured
* graphical interface that sits on top of an SVDRP connection.
*
- * $Id: svdrp.c 1.41 2002/09/04 10:49:42 kls Exp $
+ * $Id: svdrp.c 1.42 2002/09/08 11:22:57 kls Exp $
*/
#include "svdrp.h"
@@ -387,6 +387,7 @@ void cSVDRP::CmdCHAN(const char *Option)
{
if (*Option) {
int n = -1;
+ int d = 0;
if (isnumber(Option)) {
int o = strtol(Option, NULL, 10);
if (o >= 1 && o <= Channels.MaxNumber())
@@ -394,13 +395,17 @@ void cSVDRP::CmdCHAN(const char *Option)
}
else if (strcmp(Option, "-") == 0) {
n = cDevice::CurrentChannel();
- if (n > 1)
+ if (n > 1) {
n--;
+ d = -1;
+ }
}
else if (strcmp(Option, "+") == 0) {
n = cDevice::CurrentChannel();
- if (n < Channels.MaxNumber())
+ if (n < Channels.MaxNumber()) {
n++;
+ d = 1;
+ }
}
else {
int i = 1;
@@ -417,17 +422,21 @@ void cSVDRP::CmdCHAN(const char *Option)
Reply(501, "Undefined channel \"%s\"", Option);
return;
}
- cChannel *channel = Channels.GetByNumber(n);
- if (channel) {
- if (!cDevice::PrimaryDevice()->SwitchChannel(channel, true)) {
- Reply(554, "Error switching to channel \"%d\"", channel->number);
+ if (!d) {
+ cChannel *channel = Channels.GetByNumber(n);
+ if (channel) {
+ if (!cDevice::PrimaryDevice()->SwitchChannel(channel, true)) {
+ Reply(554, "Error switching to channel \"%d\"", channel->number);
+ return;
+ }
+ }
+ else {
+ Reply(550, "Unable to find channel \"%s\"", Option);
return;
}
}
- else {
- Reply(550, "Unable to find channel \"%s\"", Option);
- return;
- }
+ else
+ cDevice::SwitchChannel(d);
}
cChannel *channel = Channels.GetByNumber(cDevice::CurrentChannel());
if (channel)