summaryrefslogtreecommitdiff
path: root/svdrp.c
diff options
context:
space:
mode:
Diffstat (limited to 'svdrp.c')
-rw-r--r--svdrp.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/svdrp.c b/svdrp.c
index e0b56e4..0f6060c 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.95 2006/04/17 09:02:23 kls Exp $
+ * $Id: svdrp.c 1.96 2006/06/03 09:17:17 kls Exp $
*/
#include "svdrp.h"
@@ -550,10 +550,25 @@ void cSVDRP::CmdDELC(const char *Option)
return;
}
}
+ int CurrentChannelNr = cDevice::CurrentChannel();
+ cChannel *CurrentChannel = Channels.GetByNumber(CurrentChannelNr);
+ if (CurrentChannel && channel == CurrentChannel) {
+ int n = Channels.GetNextNormal(CurrentChannel->Index());
+ if (n < 0)
+ n = Channels.GetPrevNormal(CurrentChannel->Index());
+ CurrentChannel = Channels.Get(n);
+ CurrentChannelNr = 0; // triggers channel switch below
+ }
Channels.Del(channel);
Channels.ReNumber();
Channels.SetModified(true);
isyslog("channel %s deleted", Option);
+ if (CurrentChannel && CurrentChannel->Number() != CurrentChannelNr) {
+ if (!cDevice::PrimaryDevice()->Replaying() || cDevice::PrimaryDevice()->Transferring())
+ Channels.SwitchTo(CurrentChannel->Number());
+ else
+ cDevice::SetCurrentChannel(CurrentChannel);
+ }
Reply(250, "Channel \"%s\" deleted", Option);
}
else
@@ -1158,8 +1173,12 @@ void cSVDRP::CmdMOVC(const char *Option)
Channels.Move(FromChannel, ToChannel);
Channels.ReNumber();
Channels.SetModified(true);
- if (CurrentChannel && CurrentChannel->Number() != CurrentChannelNr)
- Channels.SwitchTo(CurrentChannel->Number());
+ if (CurrentChannel && CurrentChannel->Number() != CurrentChannelNr) {
+ if (!cDevice::PrimaryDevice()->Replaying() || cDevice::PrimaryDevice()->Transferring())
+ Channels.SwitchTo(CurrentChannel->Number());
+ else
+ cDevice::SetCurrentChannel(CurrentChannel);
+ }
isyslog("channel %d moved to %d", FromNumber, ToNumber);
Reply(250,"Channel \"%d\" moved to \"%d\"", From, To);
}