From 6b7de3763085ab2305f75ab892701ac6557bdb88 Mon Sep 17 00:00:00 2001 From: cj-vana Date: Fri, 15 May 2026 20:10:23 -0600 Subject: [PATCH] forge: allow prefixless firmware bot dms --- ...on-radio-firmware-bot-command-parity.patch | 2 +- ...n-firmware-bot-response-coordination.patch | 2 +- ...03-Allow-prefixless-firmware-bot-DMs.patch | 22 +++++++++++++++++++ tests/firmware_bot/test_firmware_bot.cpp | 9 +++++--- vendor/MeshCore | 2 +- 5 files changed, 31 insertions(+), 6 deletions(-) create mode 100644 patches/meshcore/0003-Allow-prefixless-firmware-bot-DMs.patch diff --git a/patches/meshcore/0001-Add-companion-radio-firmware-bot-command-parity.patch b/patches/meshcore/0001-Add-companion-radio-firmware-bot-command-parity.patch index a56783e..2159434 100644 --- a/patches/meshcore/0001-Add-companion-radio-firmware-bot-command-parity.patch +++ b/patches/meshcore/0001-Add-companion-radio-firmware-bot-command-parity.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: cj-vana Date: Fri, 15 May 2026 11:44:21 -0600 -Subject: [PATCH 1/2] Add companion radio firmware bot command parity +Subject: [PATCH 1/3] Add companion radio firmware bot command parity --- .../companion_radio/BotCommandRegistry.cpp | 121 ++ diff --git a/patches/meshcore/0002-Harden-firmware-bot-response-coordination.patch b/patches/meshcore/0002-Harden-firmware-bot-response-coordination.patch index 39fe17f..d26653e 100644 --- a/patches/meshcore/0002-Harden-firmware-bot-response-coordination.patch +++ b/patches/meshcore/0002-Harden-firmware-bot-response-coordination.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: cj-vana Date: Fri, 15 May 2026 19:58:42 -0600 -Subject: [PATCH 2/2] Harden firmware bot response coordination +Subject: [PATCH 2/3] Harden firmware bot response coordination --- examples/companion_radio/BotCommands.cpp | 2 +- diff --git a/patches/meshcore/0003-Allow-prefixless-firmware-bot-DMs.patch b/patches/meshcore/0003-Allow-prefixless-firmware-bot-DMs.patch new file mode 100644 index 0000000..658bf8c --- /dev/null +++ b/patches/meshcore/0003-Allow-prefixless-firmware-bot-DMs.patch @@ -0,0 +1,22 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: cj-vana +Date: Fri, 15 May 2026 20:09:58 -0600 +Subject: [PATCH 3/3] Allow prefixless firmware bot DMs + +--- + examples/companion_radio/BotPolicy.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/examples/companion_radio/BotPolicy.cpp b/examples/companion_radio/BotPolicy.cpp +index 33de45f8..7d0e6029 100644 +--- a/examples/companion_radio/BotPolicy.cpp ++++ b/examples/companion_radio/BotPolicy.cpp +@@ -75,7 +75,7 @@ bool isEmergency(BotChannelKind kind) { + } + + bool isPrefixlessCommandAllowed(BotChannelKind kind) { +- return kind == BOT_CHANNEL_BOT || kind == BOT_CHANNEL_TESTING; ++ return kind == BOT_CHANNEL_DM || kind == BOT_CHANNEL_BOT || kind == BOT_CHANNEL_TESTING; + } + + } diff --git a/tests/firmware_bot/test_firmware_bot.cpp b/tests/firmware_bot/test_firmware_bot.cpp index 76950fe..1e0b2fd 100644 --- a/tests/firmware_bot/test_firmware_bot.cpp +++ b/tests/firmware_bot/test_firmware_bot.cpp @@ -57,6 +57,7 @@ static void test_channel_policy() { assert(BotPolicy::classifyChannel(NULL, 0, true) == BOT_CHANNEL_DM); assert(BotPolicy::decide(BOT_CHANNEL_DM) == BOT_POLICY_ALLOW_NORMAL); assert(BotPolicy::isNormalAllowed(BOT_CHANNEL_DM)); + assert(BotPolicy::isPrefixlessCommandAllowed(BOT_CHANNEL_DM)); assert(BotPolicy::classifyChannel("Public", 6, false) == BOT_CHANNEL_PUBLIC); assert(BotPolicy::classifyChannel("public", 6, false) == BOT_CHANNEL_OTHER); assert(BotPolicy::classifyChannel("#Public", 7, false) == BOT_CHANNEL_OTHER); @@ -81,7 +82,6 @@ static void test_channel_policy() { assert(BotPolicy::classifyChannel("#botnet", 7, false) == BOT_CHANNEL_OTHER); assert(BotPolicy::decide(BOT_CHANNEL_OTHER) == BOT_POLICY_IGNORE); assert(!BotPolicy::isPrefixlessCommandAllowed(BOT_CHANNEL_OTHER)); - assert(!BotPolicy::isPrefixlessCommandAllowed(BOT_CHANNEL_DM)); } static void test_bot_prefs_defaults() { @@ -327,7 +327,8 @@ static void test_parse_command() { assert(command.id == BOT_COMMAND_PING); assert(parse_channel_command(BOT_CHANNEL_TESTING, "ping", &command)); assert(command.id == BOT_COMMAND_PING); - assert(!parse_channel_command(BOT_CHANNEL_DM, "ping", &command)); + assert(parse_channel_command(BOT_CHANNEL_DM, "ping", &command)); + assert(command.id == BOT_COMMAND_PING); assert(!parse_channel_command(BOT_CHANNEL_PUBLIC, "ping", &command)); assert(!parse_channel_command(BOT_CHANNEL_OTHER, "ping", &command)); assert(!parse_channel_command(BOT_CHANNEL_EMERGENCY, "ping", &command)); @@ -336,7 +337,9 @@ static void test_parse_command() { assert(FirmwareBot::parseCommand("status please", 13, &command, true)); assert(command.id == BOT_COMMAND_STATUS); assert(strcmp(command.args, "please") == 0); - assert(!parse_channel_command(BOT_CHANNEL_DM, "status please", &command)); + assert(parse_channel_command(BOT_CHANNEL_DM, "status please", &command)); + assert(command.id == BOT_COMMAND_STATUS); + assert(strcmp(command.args, "please") == 0); assert(!parse_channel_command(BOT_CHANNEL_PUBLIC, "status please", &command)); assert(!parse_channel_command(BOT_CHANNEL_BOT, "random prose", &command)); assert(!FirmwareBot::parseCommand("random prose", 12, &command, true)); diff --git a/vendor/MeshCore b/vendor/MeshCore index b9ce1fd..1c7349f 160000 --- a/vendor/MeshCore +++ b/vendor/MeshCore @@ -1 +1 @@ -Subproject commit b9ce1fd38ed7c67974643fa19c238b4387c7459c +Subproject commit 1c7349f91a78408d1b68de7e56e15910a00b0718