mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-29 16:31:05 +02:00
neutrino: refactor the PROGRAMLOCKSTATUS code
Rewrite the NeutrinoMessages::EVT_PROGRAMLOCKSTATUS handling code to
be more readable and understandable. Should be functionally equivalent.
git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@1230 e54a6e83-5905-42d5-8d5c-058d10e6a962
Origin commit data
------------------
Branch: ni/coolstream
Commit: 696e168de7
Author: Stefan Seyfried <seife@tuxbox-git.slipkontur.de>
Date: 2011-02-27 (Sun, 27 Feb 2011)
------------------
This commit was generated by Migit
This commit is contained in:
@@ -874,53 +874,64 @@ bool CChannelList::showInfo(int pos, int epgpos)
|
||||
|
||||
int CChannelList::handleMsg(const neutrino_msg_t msg, neutrino_msg_data_t data)
|
||||
{
|
||||
if ( msg == NeutrinoMessages::EVT_PROGRAMLOCKSTATUS) {
|
||||
bool startvideo = true;
|
||||
|
||||
if (msg != NeutrinoMessages::EVT_PROGRAMLOCKSTATUS) // right now the only message handled here.
|
||||
return messages_return::unhandled;
|
||||
|
||||
//printf("===> program-lock-status: %d zp: %d\n", data, zapProtection != NULL);
|
||||
|
||||
if (g_settings.parentallock_prompt == PARENTALLOCK_PROMPT_NEVER)
|
||||
goto out;
|
||||
|
||||
// 0x100 als FSK-Status zeigt an, dass (noch) kein EPG zu einem Kanal der NICHT angezeigt
|
||||
// werden sollte (vorgesperrt) da ist
|
||||
// oder das bouquet des Kanals ist vorgesperrt
|
||||
|
||||
//printf("program-lock-status: %d\n", data);
|
||||
|
||||
if ((g_settings.parentallock_prompt == PARENTALLOCK_PROMPT_ONSIGNAL) || (g_settings.parentallock_prompt == PARENTALLOCK_PROMPT_CHANGETOLOCKED))
|
||||
{
|
||||
if ( zapProtection != NULL )
|
||||
if (zapProtection != NULL) {
|
||||
zapProtection->fsk = data;
|
||||
else {
|
||||
startvideo = false;
|
||||
goto out;
|
||||
}
|
||||
|
||||
// require password if either
|
||||
// CHANGETOLOCK mode and channel/bouquet is pre locked (0x100)
|
||||
// ONSIGNAL mode and fsk(data) is beyond configured value
|
||||
// if programm has already been unlocked, dont require pin
|
||||
#if 1
|
||||
if ((data >= (neutrino_msg_data_t)g_settings.parentallock_lockage) &&
|
||||
((chanlist[selected]->last_unlocked_EPGid != g_RemoteControl->current_EPGid) || (g_RemoteControl->current_EPGid == 0)) &&
|
||||
((g_settings.parentallock_prompt != PARENTALLOCK_PROMPT_CHANGETOLOCKED) || (data >= 0x100)))
|
||||
{
|
||||
// if program has already been unlocked, dont require pin
|
||||
if (data < (neutrino_msg_data_t)g_settings.parentallock_lockage)
|
||||
goto out;
|
||||
|
||||
/* already unlocked */
|
||||
if (chanlist[selected]->last_unlocked_EPGid == g_RemoteControl->current_EPGid && g_RemoteControl->current_EPGid != 0)
|
||||
goto out;
|
||||
|
||||
/* PARENTALLOCK_PROMPT_CHANGETOLOCKED: only pre-locked channels, don't care for fsk sent in SI */
|
||||
if (g_settings.parentallock_prompt == PARENTALLOCK_PROMPT_CHANGETOLOCKED && data < 0x100)
|
||||
goto out;
|
||||
|
||||
/* OK, let's ask for a PIN */
|
||||
g_RemoteControl->stopvideo();
|
||||
zapProtection = new CZapProtection( g_settings.parentallock_pincode, data );
|
||||
//printf("stopped video\n");
|
||||
startvideo = false;
|
||||
zapProtection = new CZapProtection(g_settings.parentallock_pincode, data);
|
||||
|
||||
if ( zapProtection->check() )
|
||||
if (zapProtection->check())
|
||||
{
|
||||
g_RemoteControl->startvideo();
|
||||
|
||||
//printf("checked true\n");
|
||||
// remember it for the next time
|
||||
chanlist[selected]->last_unlocked_EPGid= g_RemoteControl->current_EPGid;
|
||||
startvideo = true;
|
||||
}
|
||||
delete zapProtection;
|
||||
zapProtection = NULL;
|
||||
}
|
||||
else
|
||||
g_RemoteControl->startvideo();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
out:
|
||||
if (startvideo)
|
||||
g_RemoteControl->startvideo();
|
||||
|
||||
return messages_return::handled;
|
||||
}
|
||||
else
|
||||
return messages_return::unhandled;
|
||||
}
|
||||
|
||||
/* bToo default to true */
|
||||
/* TODO make this member of CNeutrinoApp, because this only called from "whole" list ? */
|
||||
bool CChannelList::adjustToChannelID(const t_channel_id channel_id, bool bToo)
|
||||
|
Reference in New Issue
Block a user