Applied the fixes to moving and deleting channels from version 1.4.0-2 to the SVDRP commands MOVC and DELC as well

This commit is contained in:
Klaus Schmidinger 2006-06-03 09:25:13 +02:00
parent 833d649e13
commit dc6666d53c
2 changed files with 25 additions and 4 deletions

View File

@ -4746,7 +4746,7 @@ Video Disk Recorder Revision History
- Fixed deleting channels in case the current channel's number changes (reported
by Mirko Dölle).
2006-06-02: Version 1.4.0-3
2006-06-03: Version 1.4.0-3
- Fixed the PremiereContentTransmissionDescriptor in 'libsi' (thanks to Stefan
Huelswitt).
@ -4758,3 +4758,5 @@ Video Disk Recorder Revision History
presumably a NOP, anyway.
- Fixed the 'clean-plugins' target in the Makefile to also remove additional
plugin libraries (thanks to Wayne Keer).
- Applied the fixes to moving and deleting channels from version 1.4.0-2 to the
SVDRP commands MOVC and DELC as well.

25
svdrp.c
View File

@ -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);
}