mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-08-02 02:06:11 +00:00
Direct message: show only favourited companions
The contact picker now lists only contacts of type ADV_TYPE_CHAT that have the favourite flag set. Shows "No favourites" when none are starred. Asterisk prefix removed since all entries are favourites. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
a26bde6ce5
commit
bd07ff6099
@@ -922,19 +922,13 @@ public:
|
|||||||
_kb_caps = false; _kb_ph_mode = false; _kb_ph_sel = 0;
|
_kb_caps = false; _kb_ph_mode = false; _kb_ph_sel = 0;
|
||||||
_kb_text[0] = '\0';
|
_kb_text[0] = '\0';
|
||||||
|
|
||||||
// build contact list: chat companions only, favourites first
|
// build contact list: favourited chat companions only
|
||||||
ContactInfo c;
|
ContactInfo c;
|
||||||
int total = the_mesh.getNumContacts();
|
int total = the_mesh.getNumContacts();
|
||||||
int nfavs = 0;
|
|
||||||
for (int i = 0; i < total; i++)
|
|
||||||
if (the_mesh.getContactByIdx(i, c) && c.type == ADV_TYPE_CHAT && (c.flags & 0x01)) nfavs++;
|
|
||||||
int fpos = 0, npos = nfavs;
|
|
||||||
_num_contacts = 0;
|
_num_contacts = 0;
|
||||||
for (int i = 0; i < total; i++) {
|
for (int i = 0; i < total; i++) {
|
||||||
if (!the_mesh.getContactByIdx(i, c) || c.type != ADV_TYPE_CHAT) continue;
|
if (!the_mesh.getContactByIdx(i, c) || c.type != ADV_TYPE_CHAT) continue;
|
||||||
if (c.flags & 0x01) _sorted[fpos++] = i;
|
if (c.flags & 0x01) _sorted[_num_contacts++] = i;
|
||||||
else _sorted[npos++] = i;
|
|
||||||
_num_contacts++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
buildChannelList();
|
buildChannelList();
|
||||||
@@ -979,7 +973,7 @@ public:
|
|||||||
display.fillRect(0, 10, display.width(), 1);
|
display.fillRect(0, 10, display.width(), 1);
|
||||||
|
|
||||||
if (_num_contacts == 0) {
|
if (_num_contacts == 0) {
|
||||||
display.drawTextCentered(display.width()/2, 32, "No contacts");
|
display.drawTextCentered(display.width()/2, 32, "No favourites");
|
||||||
return 5000;
|
return 5000;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -999,9 +993,8 @@ public:
|
|||||||
|
|
||||||
ContactInfo c;
|
ContactInfo c;
|
||||||
if (the_mesh.getContactByIdx(mesh_idx, c)) {
|
if (the_mesh.getContactByIdx(mesh_idx, c)) {
|
||||||
bool fav = (c.flags & 0x01);
|
|
||||||
display.setCursor(0, y);
|
display.setCursor(0, y);
|
||||||
display.print(sel ? ">" : (fav ? "*" : " "));
|
display.print(sel ? ">" : " ");
|
||||||
char filtered[sizeof(c.name)];
|
char filtered[sizeof(c.name)];
|
||||||
display.translateUTF8ToBlocks(filtered, c.name, sizeof(filtered));
|
display.translateUTF8ToBlocks(filtered, c.name, sizeof(filtered));
|
||||||
display.drawTextEllipsized(8, y, display.width() - 24, filtered);
|
display.drawTextEllipsized(8, y, display.width() - 24, filtered);
|
||||||
|
|||||||
Reference in New Issue
Block a user