mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-26 23:13:00 +02:00
gui/cam_menu.cpp: hack: save blind answer as pincode and re-use it if enabled
Origin commit data
------------------
Branch: ni/coolstream
Commit: 04aa958d19
Author: [CST] Focus <focus.cst@gmail.com>
Date: 2015-09-24 (Thu, 24 Sep 2015)
------------------
No further description and justification available within origin commit message!
------------------
This commit was generated by Migit
This commit is contained in:
@@ -52,6 +52,7 @@
|
||||
#include <eitd/edvbstring.h>
|
||||
#include <zapit/capmt.h>
|
||||
#include <zapit/zapit.h>
|
||||
#include <driver/abstime.h>
|
||||
|
||||
void CCAMMenuHandler::init(void)
|
||||
{
|
||||
@@ -114,6 +115,7 @@ int CCAMMenuHandler::doMainMenu()
|
||||
cammenu->addItem( new CMenuOptionNumberChooser(LOCALE_CI_CLOCK, &g_settings.ci_clock, true, 6, 12, this));
|
||||
}
|
||||
cammenu->addItem( new CMenuOptionChooser(LOCALE_CI_IGNORE_MSG, &g_settings.ci_ignore_messages, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true));
|
||||
cammenu->addItem( new CMenuOptionChooser(LOCALE_CI_SAVE_PINCODE, &g_settings.ci_save_pincode, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, this));
|
||||
cammenu->addItem( GenericMenuSeparatorLine );
|
||||
}
|
||||
|
||||
@@ -393,9 +395,26 @@ int CCAMMenuHandler::handleCamMsg(const neutrino_msg_t msg, neutrino_msg_data_t
|
||||
|
||||
std::string ENQAnswer;
|
||||
|
||||
CEnquiryInput *Inquiry = new CEnquiryInput((char *)convertDVBUTF8(pMmiEnquiry->enquiryText, strlen(pMmiEnquiry->enquiryText), 0).c_str(), &ENQAnswer, pMmiEnquiry->answerlen, pMmiEnquiry->blind != 0, NONEXISTANT_LOCALE);
|
||||
Inquiry->exec(NULL, "");
|
||||
delete Inquiry;
|
||||
if (/* !from_menu && */ g_settings.ci_save_pincode && pMmiEnquiry->blind != 0 && (int) g_settings.ci_pincode.length() == pMmiEnquiry->answerlen) {
|
||||
static int acount = 0;
|
||||
static time_t last_ask = 0;
|
||||
|
||||
ENQAnswer = g_settings.ci_pincode;
|
||||
printf("CCAMMenuHandler::handleCamMsg: using saved answer [%s] (#%d, time diff %d)\n", ENQAnswer.c_str(), acount, (int) (time_monotonic() - last_ask));
|
||||
if ((time_monotonic() - last_ask) < 10) {
|
||||
acount++;
|
||||
if (acount > 4)
|
||||
g_settings.ci_pincode.clear();
|
||||
} else {
|
||||
last_ask = time_monotonic();
|
||||
acount = 0;
|
||||
}
|
||||
} else {
|
||||
CEnquiryInput *Inquiry = new CEnquiryInput((char *)convertDVBUTF8(pMmiEnquiry->enquiryText, strlen(pMmiEnquiry->enquiryText), 0).c_str(), &ENQAnswer, pMmiEnquiry->answerlen, pMmiEnquiry->blind != 0, NONEXISTANT_LOCALE);
|
||||
Inquiry->exec(NULL, "");
|
||||
delete Inquiry;
|
||||
g_settings.ci_pincode = ENQAnswer;
|
||||
}
|
||||
|
||||
printf("CCAMMenuHandler::handleCamMsg: input=[%s]\n", ENQAnswer.c_str());
|
||||
|
||||
@@ -504,12 +523,19 @@ int CCAMMenuHandler::doMenu(int slot, CA_SLOT_TYPE slotType)
|
||||
return res;
|
||||
}
|
||||
|
||||
bool CCAMMenuHandler::changeNotify(const neutrino_locale_t OptionName, void * /*Data*/)
|
||||
bool CCAMMenuHandler::changeNotify(const neutrino_locale_t OptionName, void * Data)
|
||||
{
|
||||
if (ARE_LOCALES_EQUAL(OptionName, LOCALE_CI_CLOCK)) {
|
||||
printf("CCAMMenuHandler::changeNotify: ci_clock %d\n", g_settings.ci_clock);
|
||||
ca->SetTSClock(g_settings.ci_clock * 1000000);
|
||||
return true;
|
||||
}
|
||||
else if (ARE_LOCALES_EQUAL(OptionName, LOCALE_CI_SAVE_PINCODE)) {
|
||||
int enabled = *(int *) Data;
|
||||
if (!enabled) {
|
||||
printf("CCAMMenuHandler::changeNotify: clear saved pincode\n");
|
||||
g_settings.ci_pincode.clear();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
Reference in New Issue
Block a user