diff options
author | Michael Vetter <jubalh@iodoru.org> | 2020-01-23 18:29:49 +0100 |
---|---|---|
committer | Michael Vetter <jubalh@iodoru.org> | 2020-01-23 18:29:49 +0100 |
commit | 10c4032d12715c0db7a1a67d8165b18612749f4f (patch) | |
tree | 0d2c2fde937f2bd09cfa5cd7e9daef680b4f6606 /src/ui | |
parent | 31509022efda4427cd77a1240d21a2d442363f11 (diff) | |
download | profani-tty-10c4032d12715c0db7a1a67d8165b18612749f4f.tar.gz |
Respect `/roster room use` setting also when sorted for service
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/rosterwin.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/src/ui/rosterwin.c b/src/ui/rosterwin.c index 5e240468..02bed821 100644 --- a/src/ui/rosterwin.c +++ b/src/ui/rosterwin.c @@ -768,18 +768,23 @@ _rosterwin_room(ProfLayoutSplit *layout, ProfMucWin *mucwin) if ((g_strcmp0(unreadpos, "before") == 0) && mucwin->unread > 0) { g_string_append_printf(msg, "(%d) ", mucwin->unread); } + + char *use_as_name = prefs_get_string(PREF_ROSTER_ROOMS_USE_AS_NAME); char *roombypref = prefs_get_string(PREF_ROSTER_ROOMS_BY); + if (g_strcmp0(roombypref, "service") == 0) { - Jid *jidp = jid_create(mucwin->roomjid); - g_string_append(msg, jidp->localpart); - jid_destroy(jidp); + if (mucwin->room_name == NULL || (g_strcmp0(use_as_name, "jid") == 0)) { + Jid *jidp = jid_create(mucwin->roomjid); + g_string_append(msg, jidp->localpart); + jid_destroy(jidp); + } else { + g_string_append(msg, mucwin->room_name); + } } else { gboolean show_server = prefs_get_boolean(PREF_ROSTER_ROOMS_SERVER); - char *use_as_name = prefs_get_string(PREF_ROSTER_ROOMS_USE_AS_NAME); if (show_server) { - if (mucwin->room_name == NULL || - (g_strcmp0(use_as_name, "jid") == 0)) { + if (mucwin->room_name == NULL || (g_strcmp0(use_as_name, "jid") == 0)) { g_string_append(msg, mucwin->roomjid); } else { g_string_append(msg, mucwin->room_name); @@ -796,10 +801,11 @@ _rosterwin_room(ProfLayoutSplit *layout, ProfMucWin *mucwin) jid_destroy(jidp); } - - prefs_free_string(use_as_name); } + + prefs_free_string(use_as_name); prefs_free_string(roombypref); + if ((g_strcmp0(unreadpos, "after") == 0) && mucwin->unread > 0) { g_string_append_printf(msg, " (%d)", mucwin->unread); } |