1
0
mirror of https://github.com/rofafor/vdr-plugin-satip.git synced 2023-10-10 13:37:42 +02:00

Check source validity also in server assign (Thanks to Patrick Boettcher).

This commit is contained in:
Rolf Ahrenberg 2016-07-31 12:00:55 +03:00
parent 0f9e0014df
commit db0c18ba33

View File

@ -204,9 +204,23 @@ int cSatipServer::Compare(const cListObject &listObjectP) const
return result; return result;
} }
bool cSatipServer::IsValidSource(int sourceP)
{
if (sourceFiltersM[0]) {
for (unsigned int i = 0; i < ELEMENTS(sourceFiltersM); ++i) {
if (sourceP == sourceFiltersM[i]) {
return true;
}
}
return false;
}
return true;
}
bool cSatipServer::Assign(int deviceIdP, int sourceP, int systemP, int transponderP) bool cSatipServer::Assign(int deviceIdP, int sourceP, int systemP, int transponderP)
{ {
bool result = false; bool result = false;
if (IsValidSource(sourceP)) {
if (cSource::IsType(sourceP, 'S')) if (cSource::IsType(sourceP, 'S'))
result = frontendsM[eSatipFrontendDVBS2].Assign(deviceIdP, transponderP); result = frontendsM[eSatipFrontendDVBS2].Assign(deviceIdP, transponderP);
else if (cSource::IsType(sourceP, 'T')) { else if (cSource::IsType(sourceP, 'T')) {
@ -221,22 +235,10 @@ bool cSatipServer::Assign(int deviceIdP, int sourceP, int systemP, int transpond
else else
result = frontendsM[eSatipFrontendDVBC].Assign(deviceIdP, transponderP) || frontendsM[eSatipFrontendDVBC2].Assign(deviceIdP, transponderP); result = frontendsM[eSatipFrontendDVBC].Assign(deviceIdP, transponderP) || frontendsM[eSatipFrontendDVBC2].Assign(deviceIdP, transponderP);
} }
}
return result; return result;
} }
bool cSatipServer::IsValidSource(int sourceP)
{
if (sourceFiltersM[0]) {
for (unsigned int i = 0; i < ELEMENTS(sourceFiltersM); ++i) {
if (sourceP == sourceFiltersM[i]) {
return true;
}
}
return false;
}
return true;
}
bool cSatipServer::Matches(int sourceP) bool cSatipServer::Matches(int sourceP)
{ {
if (IsValidSource(sourceP)) { if (IsValidSource(sourceP)) {