summaryrefslogtreecommitdiff
path: root/svdrp.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2002-12-22 14:07:51 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2002-12-22 14:07:51 +0100
commit3b88ba1cd2d44b47c619e1a49275377fcd9af7a3 (patch)
tree089ba3b2fdee064ccf29e23e72cdd0d3e79a9394 /svdrp.c
parentde1366fc7ed67cd5b1952b5fef3269753f52dea6 (diff)
downloadvdr-3b88ba1cd2d44b47c619e1a49275377fcd9af7a3.tar.gz
vdr-3b88ba1cd2d44b47c619e1a49275377fcd9af7a3.tar.bz2
The SVDRP command CHAN now also accepts channel IDs
Diffstat (limited to 'svdrp.c')
-rw-r--r--svdrp.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/svdrp.c b/svdrp.c
index 66b420cf..102abe0d 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.49 2002/11/10 12:09:56 kls Exp $
+ * $Id: svdrp.c 1.50 2002/12/22 14:04:08 kls Exp $
*/
#include "svdrp.h"
@@ -174,8 +174,8 @@ bool cPUTEhandler::Process(const char *s)
#define MAXHELPTOPIC 10
const char *HelpPages[] = {
- "CHAN [ + | - | <number> | <name> ]\n"
- " Switch channel up, down or to the given channel number or name.\n"
+ "CHAN [ + | - | <number> | <name> | <id> ]\n"
+ " Switch channel up, down or to the given channel number, name or id.\n"
" Without option (or after successfully switching to the channel)\n"
" it returns the current channel number and name.",
"CLRE\n"
@@ -412,15 +412,19 @@ void cSVDRP::CmdCHAN(const char *Option)
}
}
else {
- int i = 1;
- cChannel *channel;
- while ((channel = Channels.GetByNumber(i, 1)) != NULL) {
- if (strcasecmp(channel->Name(), Option) == 0) {
- n = i;
- break;
+ cChannel *channel = Channels.GetByChannelID(tChannelID::FromString(Option));
+ if (channel)
+ n = channel->Number();
+ else {
+ int i = 1;
+ while ((channel = Channels.GetByNumber(i, 1)) != NULL) {
+ if (strcasecmp(channel->Name(), Option) == 0) {
+ n = channel->Number();
+ break;
+ }
+ i = channel->Number() + 1;
}
- i = channel->Number() + 1;
- }
+ }
}
if (n < 0) {
Reply(501, "Undefined channel \"%s\"", Option);