diff options
author | Marvin W <git@larma.de> | 2020-01-09 14:28:08 +0100 |
---|---|---|
committer | Marvin W <git@larma.de> | 2020-01-09 14:28:08 +0100 |
commit | 3fc9bdab053e23ab8e97afadfee0a05afad8d890 (patch) | |
tree | d0637d1aaf6f54ba68e6ce26816518a63eb5f6fb /main/src/ui/util | |
parent | 5e1f646cbcc0cc4ac08faf76afe5becba4dfd4c6 (diff) | |
download | dino-3fc9bdab053e23ab8e97afadfee0a05afad8d890.tar.gz dino-3fc9bdab053e23ab8e97afadfee0a05afad8d890.zip |
Correctly display names in groupchat pms
Also show "Me" when no local alias is set instead of JID
Diffstat (limited to 'main/src/ui/util')
-rw-r--r-- | main/src/ui/util/helper.vala | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/main/src/ui/util/helper.vala b/main/src/ui/util/helper.vala index 83f6b3dc..c332dcfb 100644 --- a/main/src/ui/util/helper.vala +++ b/main/src/ui/util/helper.vala @@ -146,10 +146,10 @@ public static string get_participant_display_name(StreamInteractor stream_intera } private static string? get_real_display_name(StreamInteractor stream_interactor, Account account, Jid jid, bool me_is_me = false) { - if (me_is_me && jid.equals_bare(account.bare_jid)) { - return _("Me"); - } - if (jid.equals_bare(account.bare_jid) && account.alias != null && account.alias.length != 0) { + if (jid.equals_bare(account.bare_jid)) { + if (me_is_me || account.alias == null || account.alias.length == 0) { + return _("Me"); + } return account.alias; } Roster.Item roster_item = stream_interactor.get_module(RosterManager.IDENTITY).get_roster_item(account, jid); @@ -181,16 +181,17 @@ private static string get_groupchat_display_name(StreamInteractor stream_interac return jid.to_string(); } -private static string get_occupant_display_name(StreamInteractor stream_interactor, Account account, Jid jid, bool me_is_me = false) { - /* TODO: MUC Real JID - MucManager muc_manager = stream_interactor.get_module(MucManager.IDENTITY); - if (muc_manager.is_private_room(account, jid.bare_jid)) { - Jid? real_jid = muc_manager.get_real_jid(jid, account); - if (real_jid != null) { - string? display_name = get_real_display_name(stream_interactor, account, real_jid, me_is_me); - if (display_name != null) return display_name; +private static string get_occupant_display_name(StreamInteractor stream_interactor, Account account, Jid jid, bool me_is_me = false, bool muc_real_name = false) { + if (muc_real_name) { + MucManager muc_manager = stream_interactor.get_module(MucManager.IDENTITY); + if (muc_manager.is_private_room(account, jid.bare_jid)) { + Jid? real_jid = muc_manager.get_real_jid(jid, account); + if (real_jid != null) { + string? display_name = get_real_display_name(stream_interactor, account, real_jid, me_is_me); + if (display_name != null) return display_name; + } } - }*/ + } return jid.resourcepart ?? jid.to_string(); } |