mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-09-14 15:16:40 +00:00
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:
@@ -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
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user