Don't show messages from Ignored nodes (#11068)

* Honor Node Ignore messages

* Screenless node fix
This commit is contained in:
HarukiToreda
2026-07-19 06:32:34 -05:00
committed by GitHub
co-authored by GitHub
parent b8b5582943
commit 8c6cc5dbde
16 changed files with 195 additions and 45 deletions
+6 -6
View File
@@ -2110,7 +2110,7 @@ int Screen::handleInputEvent(const InputEvent *event)
if (ui->getUiState()->currentFrame == framesetInfo.positions.textMessage) {
if (event->inputEvent == INPUT_BROKER_UP) {
if (messageStore.getMessages().empty()) {
if (!messageStore.hasVisibleMessages()) {
cannedMessageModule->LaunchWithDestination(NODENUM_BROADCAST);
} else {
graphics::MessageRenderer::scrollUp();
@@ -2120,7 +2120,7 @@ int Screen::handleInputEvent(const InputEvent *event)
}
if (event->inputEvent == INPUT_BROKER_DOWN) {
if (messageStore.getMessages().empty()) {
if (!messageStore.hasVisibleMessages()) {
cannedMessageModule->LaunchWithDestination(NODENUM_BROADCAST);
} else {
graphics::MessageRenderer::scrollDown();
@@ -2169,9 +2169,9 @@ int Screen::handleInputEvent(const InputEvent *event)
if (!inputIntercepted) {
#if defined(INPUTDRIVER_ENCODER_TYPE) && INPUTDRIVER_ENCODER_TYPE == 2
bool handledEncoderScroll = false;
const bool isTextMessageFrame = (framesetInfo.positions.textMessage != 255 &&
this->ui->getUiState()->currentFrame == framesetInfo.positions.textMessage &&
!messageStore.getMessages().empty());
const bool isTextMessageFrame =
(framesetInfo.positions.textMessage != 255 &&
this->ui->getUiState()->currentFrame == framesetInfo.positions.textMessage && messageStore.hasVisibleMessages());
if (isTextMessageFrame) {
if (event->inputEvent == INPUT_BROKER_UP_LONG) {
graphics::MessageRenderer::nudgeScroll(-1);
@@ -2254,7 +2254,7 @@ int Screen::handleInputEvent(const InputEvent *event)
} else if (this->ui->getUiState()->currentFrame == framesetInfo.positions.lora) {
menuHandler::loraMenu();
} else if (this->ui->getUiState()->currentFrame == framesetInfo.positions.textMessage) {
if (!messageStore.getMessages().empty()) {
if (messageStore.hasVisibleMessages()) {
menuHandler::messageResponseMenu();
} else {
if (currentResolution == ScreenResolution::UltraLow) {
+7 -4
View File
@@ -70,12 +70,15 @@ const StoredMessage *getNewestMessageForActiveThread()
const uint32_t peer = graphics::MessageRenderer::getThreadPeer();
const uint32_t localNode = nodeDB->getNodeNum();
if (mode == graphics::MessageRenderer::ThreadMode::ALL) {
return &messages.back();
}
for (auto it = messages.rbegin(); it != messages.rend(); ++it) {
const StoredMessage &m = *it;
if (!messageStore.isMessageVisible(m)) {
continue;
}
if (mode == graphics::MessageRenderer::ThreadMode::ALL) {
return &m;
}
if (mode == graphics::MessageRenderer::ThreadMode::CHANNEL) {
if (m.type == MessageType::BROADCAST && static_cast<int>(m.channelIndex) == channel) {
+2
View File
@@ -403,6 +403,8 @@ void drawTextMessageFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16
// Filter messages based on thread mode
std::deque<StoredMessage> filtered;
for (const auto &m : messageStore.getLiveMessages()) {
if (!messageStore.isMessageVisible(m))
continue;
bool include = false;
switch (currentMode) {
case ThreadMode::ALL:
@@ -234,7 +234,8 @@ std::string InkHUD::NotificationApplet::getNotificationText(uint16_t widthAvaila
// Pick source of message
const StoredMessage *message =
msgIsBroadcast ? &inkhud->persistence->latestMessage.broadcast : &inkhud->persistence->latestMessage.dm;
if (!message->sender || !messageStore.isMessageVisible(*message))
return parse(text);
// Find info about the sender
meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(message->sender);
@@ -270,4 +271,4 @@ std::string InkHUD::NotificationApplet::getNotificationText(uint16_t widthAvaila
return parse(text);
}
#endif
#endif
@@ -46,7 +46,7 @@ void InkHUD::AllMessageApplet::onRender(bool full)
message = &latestMessage->dm;
// Short circuit: no text message
if (!message->sender) {
if (!message->sender || !messageStore.isMessageVisible(*message)) {
printAt(X(0.5), Y(0.5), "No Message", CENTER, MIDDLE);
return;
}
@@ -138,4 +138,4 @@ bool InkHUD::AllMessageApplet::approveNotification(Notification &n)
return true;
}
#endif
#endif
@@ -42,7 +42,7 @@ int InkHUD::DMApplet::onReceiveTextMessage(const meshtastic_MeshPacket *p)
void InkHUD::DMApplet::onRender(bool full)
{
// Abort if no text message
if (!latestMessage->dm.sender) {
if (!latestMessage->dm.sender || !messageStore.isMessageVisible(latestMessage->dm)) {
printAt(X(0.5), Y(0.5), "No DMs", CENTER, MIDDLE);
return;
}
@@ -131,4 +131,4 @@ bool InkHUD::DMApplet::approveNotification(Notification &n)
return true;
}
#endif
#endif
@@ -191,7 +191,8 @@ ProcessMessage InkHUD::ThreadedMessageApplet::handleReceived(const meshtastic_Me
return ProcessMessage::CONTINUE;
// Store in the global messageStore - this handles sender, timestamp, channel, text, and ack status
messageStore.addFromPacket(mp);
if (!messageStore.tryAddFromPacket(mp))
return ProcessMessage::CONTINUE;
// If this was an incoming message, suggest that our applet becomes foreground, if permitted
if (getFrom(&mp) != nodeDB->getNodeNum())
+7 -1
View File
@@ -534,13 +534,19 @@ int InkHUD::Events::onReceiveTextMessage(const meshtastic_MeshPacket *packet)
if (getFrom(packet) == nodeDB->getNodeNum())
return 0;
if (!messageStore.shouldStorePacket(*packet))
return 0;
bool isBroadcastMsg = isBroadcast(packet->to);
inkhud->persistence->latestMessage.wasBroadcast = isBroadcastMsg;
if (!isBroadcastMsg) {
// DMs never pass through ThreadedMessageApplet, so add them to the global store here
// so they survive reboots. Derive the latestMessage cache entry from the stored result.
inkhud->persistence->latestMessage.dm = messageStore.addFromPacket(*packet);
const StoredMessage *stored = messageStore.tryAddFromPacket(*packet);
if (!stored)
return 0;
inkhud->persistence->latestMessage.dm = *stored;
} else {
// Broadcasts are added to the global store by ThreadedMessageApplet::handleReceived().
// Here we only update the latestMessage cache used by AllMessageApplet / NotificationApplet.
@@ -26,6 +26,10 @@ void InkHUD::Persistence::loadLatestMessage()
int lastBroadcastPos = -1, lastDMPos = -1, pos = 0;
for (const StoredMessage &m : messageStore.getLiveMessages()) {
if (!messageStore.isMessageVisible(m)) {
pos++;
continue;
}
if (m.type == MessageType::BROADCAST) {
latestMessage.broadcast = m;
lastBroadcastPos = pos;