Add the ability to share ignored contacts (for blacklisting problematic nodes) (#7044)

This commit is contained in:
Ben Meadors 2025-06-15 07:34:03 -05:00 committed by GitHub
parent 66d5dde956
commit ac52edd11a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1545,15 +1545,25 @@ void NodeDB::addFromContact(meshtastic_SharedContact contact)
return;
}
info->num = contact.node_num;
info->last_heard = getValidTime(RTCQualityNTP);
info->has_user = true;
info->user = TypeConversions::ConvertToUserLite(contact.user);
info->is_favorite = true;
// Mark the node's key as manually verified to indicate trustworthiness.
info->bitfield |= NODEINFO_BITFIELD_IS_KEY_MANUALLY_VERIFIED_MASK;
updateGUIforNode = info;
powerFSM.trigger(EVENT_NODEDB_UPDATED);
notifyObservers(true); // Force an update whether or not our node counts have changed
if (contact.should_ignore) {
// If should_ignore is set,
// we need to clear the public key and other cruft, in addition to setting the node as ignored
info->is_ignored = true;
info->has_device_metrics = false;
info->has_position = false;
info->user.public_key.size = 0;
info->user.public_key.bytes[0] = 0;
} else {
info->last_heard = getValidTime(RTCQualityNTP);
info->is_favorite = true;
info->bitfield |= NODEINFO_BITFIELD_IS_KEY_MANUALLY_VERIFIED_MASK;
// Mark the node's key as manually verified to indicate trustworthiness.
updateGUIforNode = info;
powerFSM.trigger(EVENT_NODEDB_UPDATED);
notifyObservers(true); // Force an update whether or not our node counts have changed
}
saveNodeDatabaseToDisk();
}