From 105825f3127e4edc5c490d67baf34abe2983b611 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 31 Aug 2003 11:26:46 +0200 Subject: [PATCH] Actually implemented the SVDRP command DELC --- HISTORY | 3 ++- svdrp.c | 28 +++++++++++++++++++++++++--- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/HISTORY b/HISTORY index 8a11f1a5..07c182c9 100644 --- a/HISTORY +++ b/HISTORY @@ -2330,7 +2330,7 @@ Video Disk Recorder Revision History - Avoiding an unnecessary stop of an ongoing Transfer Mode when starting a recording on the primary device. -2003-08-30: Version 1.2.5pre1 +2003-08-31: Version 1.2.5pre1 - Now explicitly handling exit value 0 and 2 in 'runvdr'. - Added a missing 'w' to the allowed characters for Finnish and Swedish (thanks @@ -2345,3 +2345,4 @@ Video Disk Recorder Revision History directly (thanks to Oliver Endriss). This also improves navigating through DVD menus with the DVD plugin. - Fixed handling extra blanks in plugin command lines. +- Actually implemented the SVDRP command DELC. diff --git a/svdrp.c b/svdrp.c index c2c65948..228911e0 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.54 2003/08/30 09:35:00 kls Exp $ + * $Id: svdrp.c 1.55 2003/08/31 11:24:47 kls Exp $ */ #include "svdrp.h" @@ -464,8 +464,30 @@ void cSVDRP::CmdCLRE(const char *Option) void cSVDRP::CmdDELC(const char *Option) { - //TODO combine this with menu action (timers must be updated) - Reply(502, "DELC not yet implemented"); + if (*Option) { + if (isnumber(Option)) { + cChannel *channel = Channels.GetByNumber(strtol(Option, NULL, 10)); + if (channel) { + for (cTimer *timer = Timers.First(); timer; timer = Timers.Next(timer)) { + if (timer->Channel() == channel) { + Reply(550, "Channel \"%s\" is in use by timer %d", Option, timer->Index() + 1); + return; + } + } + Channels.Del(channel); + Channels.ReNumber(); + Channels.Save(); + isyslog("channel %s deleted", Option); + Reply(250, "Channel \"%s\" deleted", Option); + } + else + Reply(501, "Channel \"%s\" not defined", Option); + } + else + Reply(501, "Error in channel number \"%s\"", Option); + } + else + Reply(501, "Missing channel number"); } void cSVDRP::CmdDELR(const char *Option)