From 1014b696f2cb6103968ee24ae7f32472e37085a0 Mon Sep 17 00:00:00 2001 From: fiaxh Date: Fri, 28 Dec 2018 13:35:52 +0100 Subject: [PATCH] Private MUCs w/o name: Display localparts instead of barejids if name is not known --- main/src/ui/util/helper.vala | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main/src/ui/util/helper.vala b/main/src/ui/util/helper.vala index da854513..5e5988a1 100644 --- a/main/src/ui/util/helper.vala +++ b/main/src/ui/util/helper.vala @@ -58,7 +58,7 @@ public static string get_conversation_display_name(StreamInteractor stream_inter return get_display_name(stream_interactor, conversation.counterpart, conversation.account); } -public static string get_display_name(StreamInteractor stream_interactor, Jid jid, Account account) { +public static string get_display_name(StreamInteractor stream_interactor, Jid jid, Account account, bool fallback_to_localpart = false) { if (stream_interactor.get_module(MucManager.IDENTITY).is_groupchat(jid, account)) { MucManager muc_manager = stream_interactor.get_module(MucManager.IDENTITY); string room_name = muc_manager.get_room_name(account, jid); @@ -74,7 +74,7 @@ public static string get_display_name(StreamInteractor stream_interactor, Jid ji if (builder.len != 0) { builder.append(", "); } - builder.append(get_display_name(stream_interactor, occupant, account).split(" ")[0]); + builder.append(get_display_name(stream_interactor, occupant, account, true).split(" ")[0]); } return builder.str; } @@ -94,7 +94,7 @@ public static string get_display_name(StreamInteractor stream_interactor, Jid ji if (roster_item != null && roster_item.name != null && roster_item.name != "") { return roster_item.name; } - return jid.bare_jid.to_string(); + return fallback_to_localpart ? jid.localpart : jid.bare_jid.to_string(); } }