From f49b7dd8bd4740a3f5198c7b796f715e6fc66401 Mon Sep 17 00:00:00 2001 From: MarekZegare4 Date: Mon, 22 Jun 2026 14:30:44 +0200 Subject: [PATCH] fix(live-share): name the sender in DM position shares A channel [LOC] broadcast already carries the sender (sendGroupMessage prepends ": "), but the DM path sent a bare "[LOC]," with no name in it. Embed the node name as a trailing token after the coordinate so a DM share is self-describing in any chat client; parseLocShare ignores the trailing text, so receivers are unaffected. Verified: WioTrackerL1_companion_solo_dual builds clean. Co-Authored-By: Claude Opus 4.8 --- examples/companion_radio/ui-new/UITask.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/examples/companion_radio/ui-new/UITask.cpp b/examples/companion_radio/ui-new/UITask.cpp index 3079478b..25fdd0ba 100644 --- a/examples/companion_radio/ui-new/UITask.cpp +++ b/examples/companion_radio/ui-new/UITask.cpp @@ -2338,17 +2338,24 @@ void UITask::onSharedLocation(const uint8_t* pub_key, const char* name, bool UITask::sendLocationShare(int32_t lat, int32_t lon) { if (!_node_prefs) return false; - char text[40]; - snprintf(text, sizeof(text), LOCATION_MSG_TAG "%.5f,%.5f", lat / 1e6, lon / 1e6); + char text[80]; if (_node_prefs->loc_share_target_type == 0) { + // Channel: sendGroupMessage prepends ": ", so the payload already + // names the sender — keep the [LOC] text bare. + snprintf(text, sizeof(text), LOCATION_MSG_TAG "%.5f,%.5f", lat / 1e6, lon / 1e6); ChannelDetails ch; if (!the_mesh.getChannel(_node_prefs->loc_share_channel_idx, ch)) return false; return the_mesh.sendGroupMessage(rtc_clock.getCurrentTime(), ch.channel, the_mesh.getNodeName(), text, strlen(text)); } + // DM carries no per-message sender prefix, so embed the name in the text — the + // share is then self-describing in any chat client (a trailing token after the + // coordinate, which parseLocShare ignores on the receiving side). ContactInfo* c = the_mesh.lookupContactByPubKey(_node_prefs->loc_share_dm_prefix, NodePrefs::FAVOURITE_PREFIX_LEN); if (!c) return false; + snprintf(text, sizeof(text), LOCATION_MSG_TAG "%.5f,%.5f %s", + lat / 1e6, lon / 1e6, the_mesh.getNodeName()); uint32_t expected_ack = 0, est_timeout = 0; return the_mesh.sendMessage(*c, rtc_clock.getCurrentTime(), 0, text, expected_ack, est_timeout) > 0; }