mirror of
https://github.com/profanity-im/profanity.git
synced 2024-11-03 19:37:16 -05:00
Tidy rosterwin
This commit is contained in:
parent
c31ba8c066
commit
1d9d893ec0
@ -122,31 +122,9 @@ _rosterwin_resource(ProfLayoutSplit *layout, PContact contact)
|
||||
}
|
||||
} else if (prefs_get_boolean(PREF_ROSTER_PRESENCE)) {
|
||||
const char *presence = p_contact_presence(contact);
|
||||
const char *status = p_contact_status(contact);
|
||||
theme_item_t presence_colour = theme_main_presence_attrs(presence);
|
||||
char *by = prefs_get_string(PREF_ROSTER_BY);
|
||||
gboolean by_presence = g_strcmp0(by, "presence") == 0;
|
||||
gboolean has_status = p_contact_status(contact) != NULL;
|
||||
gboolean show_status = prefs_get_boolean(PREF_ROSTER_STATUS);
|
||||
if (!by_presence || (has_status && show_status)) {
|
||||
wattron(layout->subwin, theme_attrs(presence_colour));
|
||||
GString *msg = g_string_new(" ");
|
||||
if (!by_presence) {
|
||||
g_string_append(msg, presence);
|
||||
}
|
||||
if (has_status && show_status) {
|
||||
if (!by_presence) {
|
||||
g_string_append(msg, ", \"");
|
||||
} else {
|
||||
g_string_append(msg, "\"");
|
||||
}
|
||||
const char *status = p_contact_status(contact);
|
||||
g_string_append(msg, status);
|
||||
g_string_append(msg, "\"");
|
||||
}
|
||||
win_printline_nowrap(layout->subwin, msg->str);
|
||||
g_string_free(msg, TRUE);
|
||||
wattroff(layout->subwin, theme_attrs(presence_colour));
|
||||
}
|
||||
_rosterwin_presence(layout, 4, presence_colour, presence, status);
|
||||
}
|
||||
g_list_free(resources);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user