force PKI

This commit is contained in:
HarukiToreda 2025-10-16 20:38:30 -04:00
parent 4f79475b3c
commit fbf7ab0455

View File

@ -284,8 +284,6 @@ void CannedMessageModule::drawHeader(OLEDDisplay *display, int16_t x, int16_t y,
void CannedMessageModule::resetSearch() void CannedMessageModule::resetSearch()
{ {
LOG_INFO("Resetting search, restoring full destination list");
int previousDestIndex = destIndex; int previousDestIndex = destIndex;
searchQuery = ""; searchQuery = "";
@ -329,7 +327,7 @@ void CannedMessageModule::updateDestinationSelectionList()
for (size_t i = 0; i < numMeshNodes; ++i) { for (size_t i = 0; i < numMeshNodes; ++i) {
meshtastic_NodeInfoLite *node = nodeDB->getMeshNodeByIndex(i); meshtastic_NodeInfoLite *node = nodeDB->getMeshNodeByIndex(i);
if (!node || node->num == myNodeNum) if (!node || node->num == myNodeNum || !node->has_user || node->user.public_key.size != 32)
continue; continue;
const String &nodeName = node->user.long_name; const String &nodeName = node->user.long_name;
@ -347,6 +345,10 @@ void CannedMessageModule::updateDestinationSelectionList()
} }
} }
meshtastic_MeshPacket *p = allocDataPacket();
p->pki_encrypted = true;
p->channel = 0;
// Populate active channels // Populate active channels
std::vector<String> seenChannels; std::vector<String> seenChannels;
seenChannels.reserve(channels.getNumChannels()); seenChannels.reserve(channels.getNumChannels());
@ -358,15 +360,6 @@ void CannedMessageModule::updateDestinationSelectionList()
} }
} }
/* As the nodeDB is sorted, can skip this step
// Sort by favorite, then last heard
std::sort(this->filteredNodes.begin(), this->filteredNodes.end(), [](const NodeEntry &a, const NodeEntry &b) {
if (a.node->is_favorite != b.node->is_favorite)
return a.node->is_favorite > b.node->is_favorite;
return a.lastHeard < b.lastHeard;
});
*/
scrollIndex = 0; // Show first result at the top scrollIndex = 0; // Show first result at the top
destIndex = 0; // Highlight the first entry destIndex = 0; // Highlight the first entry
if (nodesChanged && runState == CANNED_MESSAGE_RUN_STATE_DESTINATION_SELECTION) { if (nodesChanged && runState == CANNED_MESSAGE_RUN_STATE_DESTINATION_SELECTION) {
@ -1289,7 +1282,6 @@ int32_t CannedMessageModule::runOnce()
this->freetext = ""; this->freetext = "";
this->cursor = 0; this->cursor = 0;
this->runState = CANNED_MESSAGE_RUN_STATE_ACTIVE; this->runState = CANNED_MESSAGE_RUN_STATE_ACTIVE;
LOG_DEBUG("MOVE UP (%d):%s", this->currentMessageIndex, this->getCurrentMessage());
} }
} else if (this->runState == CANNED_MESSAGE_RUN_STATE_ACTION_DOWN) { } else if (this->runState == CANNED_MESSAGE_RUN_STATE_ACTION_DOWN) {
if (this->messagesCount > 0) { if (this->messagesCount > 0) {
@ -1297,7 +1289,6 @@ int32_t CannedMessageModule::runOnce()
this->freetext = ""; this->freetext = "";
this->cursor = 0; this->cursor = 0;
this->runState = CANNED_MESSAGE_RUN_STATE_ACTIVE; this->runState = CANNED_MESSAGE_RUN_STATE_ACTIVE;
LOG_DEBUG("MOVE DOWN (%d):%s", this->currentMessageIndex, this->getCurrentMessage());
} }
} else if (this->runState == CANNED_MESSAGE_RUN_STATE_FREETEXT || this->runState == CANNED_MESSAGE_RUN_STATE_ACTIVE) { } else if (this->runState == CANNED_MESSAGE_RUN_STATE_FREETEXT || this->runState == CANNED_MESSAGE_RUN_STATE_ACTIVE) {
switch (this->payload) { switch (this->payload) {