feat(channels): Channel order setting - slots, newest message or name (#48)

Shared chanctl::order() builds the channel list for ui-new and the L2:
favourites first, then by ch_sort. New ch_sort pref at the end of NodePrefs,
Settings > Contacts row and contacts.channel.order CLI key.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Jakub
2026-10-14 10:46:20 +02:00
co-authored by Claude Sonnet 5.5
parent 140ea7c008
commit 24dd025086
6 changed files with 75 additions and 29 deletions
+4 -10
View File
@@ -224,16 +224,10 @@ void UITask::fillChats() {
own();
bool fav_first = !_prefs || _prefs->fav_sort;
int ch_rows = 0;
for (int pass = fav_first ? 0 : 1; pass < 2 && !chatFolded(FOLD_CHANNELS); pass++) {
for (int i = 0; i < MAX_GROUP_CHANNELS; i++) {
ChannelDetails ch;
if (!the_mesh.getChannel(i, ch) || ch.name[0] == '\0') continue;
bool fav = chanctl::favourite(_prefs, i);
if (ch_fav_only && !fav) continue;
if (fav_first && fav != (pass == 0)) continue;
ch_rows++;
vlist::add(body, &CHANNEL, i);
}
if (!chatFolded(FOLD_CHANNELS)) {
uint8_t order[MAX_GROUP_CHANNELS];
ch_rows = chanctl::order(_prefs, _core->history, order, ch_fav_only);
for (int r = 0; r < ch_rows; r++) vlist::add(body, &CHANNEL, order[r]);
}
if (!chatFolded(FOLD_CHANNELS)) {
if (ch_rows == 0 && ch_fav_only) { label(body, "No favourite channels", THEME_FONT_SMALL, theme::TEXT_MUTED); own(); }