summaryrefslogtreecommitdiff
path: root/svdrp.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2002-11-10 15:50:21 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2002-11-10 15:50:21 +0100
commit9fee2b67abb2594c5db2ca9f66525cb09e7b5cc7 (patch)
tree9d9326af17fcee00a08e55f52d268fd4e5943129 /svdrp.c
parentc67fe26e66a93b450ed46ca83b5502c47fe28eb3 (diff)
downloadvdr-9fee2b67abb2594c5db2ca9f66525cb09e7b5cc7.tar.gz
vdr-9fee2b67abb2594c5db2ca9f66525cb09e7b5cc7.tar.bz2
First step towards a 'unique channel ID'
Diffstat (limited to 'svdrp.c')
-rw-r--r--svdrp.c43
1 files changed, 27 insertions, 16 deletions
diff --git a/svdrp.c b/svdrp.c
index 2859fb9d..66b420cf 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.48 2002/10/20 12:45:03 kls Exp $
+ * $Id: svdrp.c 1.49 2002/11/10 12:09:56 kls Exp $
*/
#include "svdrp.h"
@@ -776,15 +776,20 @@ void cSVDRP::CmdMODC(const char *Option)
tail = skipspace(tail);
cChannel *channel = Channels.GetByNumber(n);
if (channel) {
- cChannel c = *channel;
- if (!c.Parse(tail)) {
- Reply(501, "Error in channel settings");
- return;
+ cChannel ch;
+ if (ch.Parse(tail, true)) {
+ if (Channels.HasUniqueChannelID(&ch, channel)) {
+ *channel = ch;
+ Channels.ReNumber();
+ Channels.Save();
+ isyslog("modifed channel %d %s", channel->Number(), channel->ToText());
+ Reply(250, "%d %s", channel->Number(), channel->ToText());
+ }
+ else
+ Reply(501, "Channel settings are not unique");
}
- *channel = c;
- Channels.Save();
- isyslog("channel %d modified", channel->Number());
- Reply(250, "%d %s", channel->Number(), channel->ToText());
+ else
+ Reply(501, "Error in channel settings");
}
else
Reply(501, "Channel \"%d\" not defined", n);
@@ -844,13 +849,19 @@ void cSVDRP::CmdMOVT(const char *Option)
void cSVDRP::CmdNEWC(const char *Option)
{
if (*Option) {
- cChannel *channel = new cChannel;
- if (channel->Parse(Option)) {
- Channels.Add(channel);
- Channels.ReNumber();
- Channels.Save();
- isyslog("channel %d added", channel->Number());
- Reply(250, "%d %s", channel->Number(), channel->ToText());
+ cChannel ch;
+ if (ch.Parse(Option, true)) {
+ if (Channels.HasUniqueChannelID(&ch)) {
+ cChannel *channel = new cChannel;
+ *channel = ch;
+ Channels.Add(channel);
+ Channels.ReNumber();
+ Channels.Save();
+ isyslog("new channel %d %s", channel->Number(), channel->ToText());
+ Reply(250, "%d %s", channel->Number(), channel->ToText());
+ }
+ else
+ Reply(501, "Channel settings are not unique");
}
else
Reply(501, "Error in channel settings");