Uplink to MQTT after potentially altering content (#3646)

Mainly for traceroute module now

Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
pull/3662/head
GUVWAF 2024-04-19 00:44:13 +02:00 zatwierdzone przez GitHub
rodzic e4b5f2ce14
commit 64edfb76e0
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: B5690EEEBB952194
1 zmienionych plików z 10 dodań i 9 usunięć

Wyświetl plik

@ -465,21 +465,22 @@ void Router::handleReceived(meshtastic_MeshPacket *p, RxSource src)
cancelSending(p->from, p->id);
skipHandle = true;
}
#if !MESHTASTIC_EXCLUDE_MQTT
// Publish received message to MQTT if we're not the original transmitter of the packet
if (!skipHandle && moduleConfig.mqtt.enabled && getFrom(p) != nodeDB->getNodeNum() && mqtt)
mqtt->onSend(*p_encrypted, *p, p->channel);
#endif
} else {
printPacket("packet decoding failed or skipped (no PSK?)", p);
}
packetPool.release(p_encrypted); // Release the encrypted packet
// call modules here
if (!skipHandle)
if (!skipHandle) {
MeshModule::callModules(*p, src);
#if !MESHTASTIC_EXCLUDE_MQTT
// After potentially altering it, publish received message to MQTT if we're not the original transmitter of the packet
if (decoded && moduleConfig.mqtt.enabled && getFrom(p) != nodeDB->getNodeNum() && mqtt)
mqtt->onSend(*p_encrypted, *p, p->channel);
#endif
}
packetPool.release(p_encrypted); // Release the encrypted packet
}
void Router::perhapsHandleReceived(meshtastic_MeshPacket *p)