diff options
author | James Booth <boothj5@gmail.com> | 2015-11-17 23:37:33 +0000 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2015-11-17 23:37:33 +0000 |
commit | 8e8852fa9f0171bb2c0826303b97655a32e481ca (patch) | |
tree | 3f6f99ad443a44ba8c841a811af700f6fb24b504 /src/ui | |
parent | 230a14219cdc12d3548464b5bdd2746b68b8e96a (diff) | |
download | profani-tty-8e8852fa9f0171bb2c0826303b97655a32e481ca.tar.gz |
Added /roster order name|presence
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/console.c | 4 | ||||
-rw-r--r-- | src/ui/rosterwin.c | 30 |
2 files changed, 31 insertions, 3 deletions
diff --git a/src/ui/console.c b/src/ui/console.c index 8825cf69..882a9b54 100644 --- a/src/ui/console.c +++ b/src/ui/console.c @@ -1226,6 +1226,10 @@ cons_roster_setting(void) cons_show("Roster by (/roster) : %s", by); prefs_free_string(by); + char *order = prefs_get_string(PREF_ROSTER_ORDER); + cons_show("Roster order (/roster) : %s", order); + prefs_free_string(order); + int size = prefs_get_roster_size(); cons_show("Roster size (/roster) : %d", size); } diff --git a/src/ui/rosterwin.c b/src/ui/rosterwin.c index b721dbfe..95d374bd 100644 --- a/src/ui/rosterwin.c +++ b/src/ui/rosterwin.c @@ -167,7 +167,15 @@ _rosterwin_contacts_by_group(ProfLayoutSplit *layout, char *group) g_string_free(title, TRUE); wattroff(layout->subwin, theme_attrs(THEME_ROSTER_HEADER)); - GSList *contacts = roster_get_group(group); + GSList *contacts = NULL; + + char *order = prefs_get_string(PREF_ROSTER_ORDER); + if (g_strcmp0(order, "presence") == 0) { + contacts = roster_get_group_ord_presence(group); + } else { + contacts = roster_get_group(group); + } + if (contacts) { GSList *curr_contact = contacts; while (curr_contact) { @@ -182,7 +190,15 @@ _rosterwin_contacts_by_group(ProfLayoutSplit *layout, char *group) static void _rosterwin_contacts_by_no_group(ProfLayoutSplit *layout) { - GSList *contacts = roster_get_nogroup(); + GSList *contacts = NULL; + + char *order = prefs_get_string(PREF_ROSTER_ORDER); + if (g_strcmp0(order, "presence") == 0) { + contacts = roster_get_nogroup_ord_presence(); + } else { + contacts = roster_get_nogroup(); + } + if (contacts) { wattron(layout->subwin, theme_attrs(THEME_ROSTER_HEADER)); win_printline_nowrap(layout->subwin, " -no group"); @@ -228,7 +244,15 @@ rosterwin_roster(void) g_slist_free_full(groups, free); _rosterwin_contacts_by_no_group(layout); } else { - GSList *contacts = roster_get_contacts(); + GSList *contacts = NULL; + + char *order = prefs_get_string(PREF_ROSTER_ORDER); + if (g_strcmp0(order, "presence") == 0) { + contacts = roster_get_contacts_ord_presence(); + } else { + contacts = roster_get_contacts(); + } + if (contacts) { werase(layout->subwin); |