fix(live-share): exclude room servers from share targets

A [LOC] DM to a room server is delivered as a plain DM, not reposted to the
room's members, so a room server can't act as a live-share broadcast target.
The main contact picker already lists CHAT contacts only, but a favourited
room server still showed up in the LEFT/RIGHT quick-cycle — skip it there,
and reject a room in commitPickTargetDM as a backstop if the room-mode list
is ever reachable during target pick.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
MarekZegare4
2026-06-24 23:50:16 +02:00
parent b07091de78
commit 94a97967ae
2 changed files with 10 additions and 1 deletions

View File

@@ -139,7 +139,10 @@ public:
const uint8_t* pre = _prefs->favourite_contacts[i];
bool empty = true;
for (int b = 0; b < NodePrefs::FAVOURITE_PREFIX_LEN; b++) if (pre[b]) { empty = false; break; }
if (empty || !the_mesh.lookupContactByPubKey(pre, NodePrefs::FAVOURITE_PREFIX_LEN)) continue;
ContactInfo* fc = the_mesh.lookupContactByPubKey(pre, NodePrefs::FAVOURITE_PREFIX_LEN);
// Skip room servers: a [LOC] DM to a room server isn't reposted to the
// room's members, so it can't serve as a live-share broadcast target.
if (empty || !fc || fc->type == ADV_TYPE_ROOM) continue;
list[n].type = 1; list[n].ch = 0;
memcpy(list[n].prefix, pre, NodePrefs::FAVOURITE_PREFIX_LEN); n++;
}

View File

@@ -908,6 +908,12 @@ public:
}
void commitPickTargetDM(const ContactInfo& ci) {
// A room server can't be a live-share target — a [LOC] DM to it is never
// reposted to the room's members. Reject the pick and keep the chooser open.
if (ci.type == ADV_TYPE_ROOM) {
_task->showAlert("Rooms not supported", 1400);
return;
}
NodePrefs* p = _task->getNodePrefs();
if (p) {
p->loc_share_target_type = 1;