fix(bot): normalize GPS reply casing, dedupe channel sender-split

Reuse the existing botChannelSenderSplit() helper for the channel
[LOC]-share sender name instead of re-implementing the same "Name: "
split inline, and fix a stray lowercase "gps:" reply that didn't
match the rest of the !gps command's replies.
This commit is contained in:
Jakub
2026-08-31 20:20:41 +02:00
parent 8ceb420b43
commit 050633b6fc
2 changed files with 5 additions and 10 deletions
+4 -9
View File
@@ -882,15 +882,10 @@ void MyMesh::onChannelMessageRecv(const mesh::GroupChannel &channel, mesh::Packe
// chatter is ignored.
int32_t loc_lat, loc_lon;
if (_ui && geo::parseLocShare(text, loc_lat, loc_lon)) {
char sender[32] = {0};
const char* sep = strstr(text, ": ");
if (sep && sep > text) {
int n = (int)(sep - text);
if (n > (int)sizeof(sender) - 1) n = sizeof(sender) - 1;
memcpy(sender, text, n);
sender[n] = '\0';
}
_ui->onSharedLocation(nullptr, sender[0] ? sender : "?", loc_lat, loc_lon, timestamp, false);
char sender[32];
const char* msg;
botChannelSenderSplit(text, sender, sizeof(sender), &msg);
_ui->onSharedLocation(nullptr, sender, loc_lat, loc_lon, timestamp, false);
}
#endif
+1 -1
View File
@@ -300,7 +300,7 @@ bool MyMesh::botCommandReply(const char* cmd, const char* arg, const char* arg2,
}
bool on = !strcmp(arg, "on"); // arg was lowercased while parsing (see botScanCommands)
bool off = !strcmp(arg, "off");
if (!on && !off) { snprintf(out, out_len, "gps: on|off|fix?"); return true; }
if (!on && !off) { snprintf(out, out_len, "GPS: on|off|fix?"); return true; }
// Deferred: applyPendingBotActions() actually flips the GPS state, once
// quiet-hours/cooldown/throttle have passed (see MyMesh.h).
_bot_gps_action_pending = true;