diff options
author | Michael Vetter <jubalh@iodoru.org> | 2019-12-19 14:02:24 +0100 |
---|---|---|
committer | Michael Vetter <jubalh@iodoru.org> | 2019-12-19 14:02:24 +0100 |
commit | c302af99b757257d07ebebc97cd2de0a516754e2 (patch) | |
tree | c34d5d897cdd59c76c125c96dd52c27291993243 /src | |
parent | 46478df097ad9f23b1063fbdb21151288038f6da (diff) | |
download | profani-tty-c302af99b757257d07ebebc97cd2de0a516754e2.tar.gz |
xep-0392: colorize roster
Diffstat (limited to 'src')
-rw-r--r-- | src/config/preferences.h | 1 | ||||
-rw-r--r-- | src/ui/rosterwin.c | 21 |
2 files changed, 19 insertions, 3 deletions
diff --git a/src/config/preferences.h b/src/config/preferences.h index 7dab115d..2f1bf131 100644 --- a/src/config/preferences.h +++ b/src/config/preferences.h @@ -144,6 +144,7 @@ typedef enum { PREF_CONSOLE_PRIVATE, PREF_CONSOLE_CHAT, PREF_COLOR_NICK, + PREF_ROSTER_COLOR_NICK, PREF_BOOKMARK_INVITE, PREF_PLUGINS_SOURCEPATH, PREF_ROOM_LIST_CACHE, diff --git a/src/ui/rosterwin.c b/src/ui/rosterwin.c index 9357814e..026a7a21 100644 --- a/src/ui/rosterwin.c +++ b/src/ui/rosterwin.c @@ -367,8 +367,17 @@ _rosterwin_contact(ProfLayoutSplit *layout, PContact contact) } theme_item_t presence_colour = _get_roster_theme(theme_type, presence); + int colour; + if (prefs_get_boolean(PREF_ROSTER_COLOR_NICK)) { + colour = theme_hash_attrs(name); + } + + if (prefs_get_boolean(PREF_ROSTER_COLOR_NICK)) { + wattron(layout->subwin, colour); + } else { + wattron(layout->subwin, theme_attrs(presence_colour)); + } - wattron(layout->subwin, theme_attrs(presence_colour)); GString *msg = g_string_new(" "); int indent = prefs_get_roster_contact_indent(); int current_indent = 0; @@ -404,7 +413,12 @@ _rosterwin_contact(ProfLayoutSplit *layout, PContact contact) gboolean wrap = prefs_get_boolean(PREF_ROSTER_WRAP); win_sub_print(layout->subwin, msg->str, FALSE, wrap, current_indent); g_string_free(msg, TRUE); - wattroff(layout->subwin, theme_attrs(presence_colour)); + + if (prefs_get_boolean(PREF_ROSTER_COLOR_NICK)) { + wattroff(layout->subwin, colour); + } else { + wattroff(layout->subwin, theme_attrs(presence_colour)); + } if (prefs_get_boolean(PREF_ROSTER_RESOURCE)) { _rosterwin_resources(layout, contact, current_indent, theme_type, unread); @@ -412,10 +426,11 @@ _rosterwin_contact(ProfLayoutSplit *layout, PContact contact) if (unread > 0) { GString *unreadmsg = g_string_new(""); g_string_append_printf(unreadmsg, " (%d)", unread); + wattron(layout->subwin, theme_attrs(presence_colour)); win_sub_print(layout->subwin, unreadmsg->str, FALSE, wrap, current_indent); g_string_free(unreadmsg, TRUE); - wattroff(layout->subwin, theme_attrs(presence_colour)); + wattroff(layout->subwin, theme_attrs(colour)); } _rosterwin_presence(layout, presence, status, current_indent); |