Add NodeDB::isFavorite, NodeDB::isFromOrToFavoritedNode

This commit is contained in:
Mike Robbins
2025-09-11 21:31:42 -07:00
parent 3cc2b70e4f
commit 484b4cd848
2 changed files with 24 additions and 0 deletions
+14
View File
@@ -1770,6 +1770,20 @@ void NodeDB::set_favorite(bool is_favorite, uint32_t nodeId)
}
}
bool NodeDB::isFavorite(uint32_t nodeId)
{
meshtastic_NodeInfoLite *lite = getMeshNode(nodeId);
if (lite) {
return lite->is_favorite;
}
return false;
}
bool NodeDB::isFromOrToFavoritedNode(const meshtastic_MeshPacket &p)
{
return isFavorite(p.from) || isFavorite(p.to);
}
void NodeDB::pause_sort(bool paused)
{
sortingIsPaused = paused;
+10
View File
@@ -185,6 +185,16 @@ class NodeDB
*/
void set_favorite(bool is_favorite, uint32_t nodeId);
/*
* Returns true if the node is in the NodeDB and marked as favorite
*/
bool isFavorite(uint32_t nodeId);
/*
* Returns true if p->from or p->to is a favorited node
*/
bool isFromOrToFavoritedNode(const meshtastic_MeshPacket &p);
/**
* Other functions like the node picker can request a pause in the node sorting
*/