From 202060af12e2d55b10645dbeaeb0a2296aea124c Mon Sep 17 00:00:00 2001 From: Jakub <106778416+MarekZegare4@users.noreply.github.com> Date: Sun, 10 May 2026 18:58:13 +0200 Subject: [PATCH] QuickMsgScreen: show only companion (chat) contacts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Filter contact list to ADV_TYPE_CHAT only — excludes repeaters, rooms, and sensors which cannot receive direct chat messages. Co-Authored-By: Claude Sonnet 4.6 --- examples/companion_radio/ui-new/UITask.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/examples/companion_radio/ui-new/UITask.cpp b/examples/companion_radio/ui-new/UITask.cpp index 1d15b554..86ed9982 100644 --- a/examples/companion_radio/ui-new/UITask.cpp +++ b/examples/companion_radio/ui-new/UITask.cpp @@ -391,17 +391,19 @@ public: _contact_sel = _contact_scroll = 0; _msg_sel = _msg_scroll = 0; _num_contacts = the_mesh.getNumContacts(); - // sort: favourites (flags & 0x01) first, rest after + // only show chat companions (not repeaters/rooms/sensors), favourites first ContactInfo c; int nfavs = 0; for (int i = 0; i < _num_contacts; i++) - if (the_mesh.getContactByIdx(i, c) && (c.flags & 0x01)) nfavs++; + if (the_mesh.getContactByIdx(i, c) && c.type == ADV_TYPE_CHAT && (c.flags & 0x01)) nfavs++; int fpos = 0, npos = nfavs; - for (int i = 0; i < _num_contacts; i++) { - if (the_mesh.getContactByIdx(i, c) && (c.flags & 0x01)) - _sorted[fpos++] = i; - else - _sorted[npos++] = i; + _num_contacts = 0; + int total = the_mesh.getNumContacts(); + for (int i = 0; i < total; i++) { + if (!the_mesh.getContactByIdx(i, c) || c.type != ADV_TYPE_CHAT) continue; + if (c.flags & 0x01) _sorted[fpos++] = i; + else _sorted[npos++] = i; + _num_contacts++; } }