Plugins refactoring: handleReceived return enumeration ProcessMessage

Use `ProcessMessage::CONTINUE` to allows other modules to process a message.
Use `ProcessMessage::STOP` to stop further message processing.
This commit is contained in:
Vladislav Osmanov
2021-09-23 04:42:09 +03:00
parent b182819aff
commit debae67ae7
13 changed files with 39 additions and 27 deletions

View File

@@ -116,7 +116,7 @@ void MeshPlugin::callPlugins(const MeshPacket &mp)
printPacket("packet on wrong channel, but can't respond", &mp);
} else {
bool handled = pi.handleReceived(mp);
ProcessMessage handled = pi.handleReceived(mp);
// Possibly send replies (but only if the message was directed to us specifically, i.e. not for promiscious
// sniffing) also: we only let the one plugin send a reply, once that happens, remaining plugins are not
@@ -140,7 +140,7 @@ void MeshPlugin::callPlugins(const MeshPacket &mp)
pi.myReply = NULL;
}
if (handled) {
if (handled == ProcessMessage::STOP) {
DEBUG_MSG("Plugin %s handled and skipped other processing\n", pi.name);
break;
}