fix: prevent router-like roles from auto-favoriting DM peers (#9821)
ROUTER and ROUTER_LATE should not accumulate favorites by sending DMs. Also replaces magic number 12 with meshtastic_Config_DeviceConfig_Role_CLIENT_BASE.
This commit is contained in:
co-authored by
GitHub
parent
a8fed3256e
commit
6ba82ed5b6
@@ -1072,12 +1072,14 @@ void CannedMessageModule::sendText(NodeNum dest, ChannelIndex channel, const cha
|
|||||||
} else {
|
} else {
|
||||||
sm.dest = dest;
|
sm.dest = dest;
|
||||||
sm.type = MessageType::DM_TO_US;
|
sm.type = MessageType::DM_TO_US;
|
||||||
// Only add as favorite if our role is NOT CLIENT_BASE
|
// Only add as favorite if our role is not router-like (ROUTER, ROUTER_LATE, CLIENT_BASE)
|
||||||
if (config.device.role != 12) {
|
if (config.device.role != meshtastic_Config_DeviceConfig_Role_ROUTER &&
|
||||||
|
config.device.role != meshtastic_Config_DeviceConfig_Role_ROUTER_LATE &&
|
||||||
|
config.device.role != meshtastic_Config_DeviceConfig_Role_CLIENT_BASE) {
|
||||||
LOG_INFO("Proactively adding %x as favorite node", dest);
|
LOG_INFO("Proactively adding %x as favorite node", dest);
|
||||||
nodeDB->set_favorite(true, dest);
|
nodeDB->set_favorite(true, dest);
|
||||||
} else {
|
} else {
|
||||||
LOG_DEBUG("Not favoriting node %x as we are CLIENT_BASE role", dest);
|
LOG_DEBUG("Not favoriting node %x because role is router-like", dest);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sm.ackStatus = AckStatus::NONE;
|
sm.ackStatus = AckStatus::NONE;
|
||||||
|
|||||||
Reference in New Issue
Block a user