diff options
Diffstat (limited to 'svdrp.c')
-rw-r--r-- | svdrp.c | 61 |
1 files changed, 56 insertions, 5 deletions
@@ -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.77 2005/08/28 14:12:00 kls Exp $ + * $Id: svdrp.c 1.80 2005/09/03 14:09:02 kls Exp $ */ #include "svdrp.h" @@ -269,12 +269,16 @@ const char *HelpPages[] = { " at the position where any previous replay was stopped, or from the beginning\n" " by default. To control or stop the replay session, use the usual remote\n" " control keypresses via the HITK command.", - "PLUG <name> [ <command> [ <options> ]]\n" + "PLUG <name> [ help | main ] [ <command> [ <options> ]]\n" " Send a command to a plugin.\n" " The PLUG command without any parameters lists all plugins.\n" " If only a name is given, all commands known to that plugin are listed.\n" " If a command is given (optionally followed by parameters), that command\n" - " is sent to the plugin, and the result will be displayed.", + " is sent to the plugin, and the result will be displayed.\n" + " The keyword 'help' lists all the SVDRP commands known to the named plugin.\n" + " If 'help' is followed by a command, the detailed help for that command is\n" + " given. The keyword 'main' initiates a call to the main menu function of the\n" + " given plugin.\n", "PUTE\n" " Put data into the EPG list. The data entered has to strictly follow the\n" " format defined in vdr(5) for the 'epg.data' file. A '.' on a line\n" @@ -1035,8 +1039,51 @@ void cSVDRP::CmdMODT(const char *Option) void cSVDRP::CmdMOVC(const char *Option) { - //TODO combine this with menu action (timers must be updated) - Reply(502, "MOVC not yet implemented"); + if (*Option) { + if (!Channels.BeingEdited() && !Timers.BeingEdited()) { + char *tail; + int From = strtol(Option, &tail, 10); + if (tail && tail != Option) { + tail = skipspace(tail); + if (tail && tail != Option) { + int To = strtol(tail, NULL, 10); + int CurrentChannelNr = cDevice::CurrentChannel(); + cChannel *CurrentChannel = Channels.GetByNumber(CurrentChannelNr); + cChannel *FromChannel = Channels.GetByNumber(From); + if (FromChannel) { + cChannel *ToChannel = Channels.GetByNumber(To); + if (ToChannel) { + int FromNumber = FromChannel->Number(); + int ToNumber = ToChannel->Number(); + if (FromNumber != ToNumber) { + Channels.Move(FromChannel, ToChannel); + Channels.ReNumber(); + Channels.SetModified(true); + if (CurrentChannel && CurrentChannel->Number() != CurrentChannelNr) + Channels.SwitchTo(CurrentChannel->Number()); + isyslog("channel %d moved to %d", FromNumber, ToNumber); + Reply(250,"Channel \"%d\" moved to \"%d\"", From, To); + } + else + Reply(501, "Can't move channel to same postion"); + } + else + Reply(501, "Channel \"%d\" not defined", To); + } + else + Reply(501, "Channel \"%d\" not defined", From); + } + else + Reply(501, "Error in channel number"); + } + else + Reply(501, "Error in channel number"); + } + else + Reply(550, "Channels or timers are being edited - try again later"); + } + else + Reply(501, "Missing channel number"); } void cSVDRP::CmdMOVT(const char *Option) @@ -1204,6 +1251,10 @@ void cSVDRP::CmdPLUG(const char *Option) Reply(214, "This plugin has no SVDRP commands"); } } + else if (strcasecmp(cmd, "MAIN") == 0) { + cRemote::CallPlugin(plugin->Name()); + Reply(250, "Initiated call to main menu function of plugin \"%s\"", plugin->Name()); + } else { int ReplyCode = 900; cString s = plugin->SVDRPCommand(cmd, option, ReplyCode); |