mirror of
https://github.com/g4klx/MMDVMHost
synced 2025-12-21 23:45:49 +08:00
Update DMRAccessControl.cpp
Updated to make string conversion only when needed and to re-add the id == m_id compare
This commit is contained in:
@@ -49,11 +49,10 @@ void CDMRAccessControl::init(const std::vector<unsigned int>& blacklist, const s
|
|||||||
|
|
||||||
bool CDMRAccessControl::validateSrcId(unsigned int id)
|
bool CDMRAccessControl::validateSrcId(unsigned int id)
|
||||||
{
|
{
|
||||||
std::string str_id = std::to_string(id); // DMR ID from RF
|
|
||||||
std::string str_m_id = std::to_string(m_id); // MMDVMHost ID from Config
|
|
||||||
if (m_selfOnly) {
|
if (m_selfOnly) {
|
||||||
// return id == m_id;
|
std::string str_id = std::to_string(id); // DMR ID from RF
|
||||||
if (str_m_id.compare(0,7,str_id) == 0) {// if the first 7 digits of the MMDVMHost ID match the WHOLE of the RF ID
|
std::string str_m_id = std::to_string(m_id); // MMDVMHost ID from Config
|
||||||
|
if ((id == m_id) || (str_m_id.compare(0,7,str_id) == 0)) {// if the RF ID matched the configured ID or if the first 7 digits of the MMDVMHost ID match the WHOLE of the RF ID
|
||||||
return true; // then allow the connection
|
return true; // then allow the connection
|
||||||
} else {
|
} else {
|
||||||
return false; // if not, reject it
|
return false; // if not, reject it
|
||||||
|
|||||||
Reference in New Issue
Block a user