Show "Me" instead of bare jid when no local alias is set

This commit is contained in:
Marvin W 2023-02-07 20:03:58 +01:00
parent d092473fe4
commit 1559a7a603
No known key found for this signature in database
GPG key ID: 072E9235DB996F2A
2 changed files with 2 additions and 9 deletions

View file

@ -20,13 +20,6 @@ namespace Dino {
} }
public static string get_participant_display_name(StreamInteractor stream_interactor, Conversation conversation, Jid participant, string? self_word = null) { public static string get_participant_display_name(StreamInteractor stream_interactor, Conversation conversation, Jid participant, string? self_word = null) {
if (self_word != null) {
if (conversation.account.bare_jid.equals_bare(participant) ||
(conversation.type_ == Conversation.Type.GROUPCHAT || conversation.type_ == Conversation.Type.GROUPCHAT_PM) &&
conversation.nickname != null && participant.equals_bare(conversation.counterpart) && conversation.nickname == participant.resourcepart) {
return self_word;
}
}
if (conversation.type_ == Conversation.Type.CHAT) { if (conversation.type_ == Conversation.Type.CHAT) {
return get_real_display_name(stream_interactor, conversation.account, participant, self_word) ?? participant.bare_jid.to_string(); return get_real_display_name(stream_interactor, conversation.account, participant, self_word) ?? participant.bare_jid.to_string();
} }
@ -38,7 +31,7 @@ namespace Dino {
public static string? get_real_display_name(StreamInteractor stream_interactor, Account account, Jid jid, string? self_word = null) { public static string? get_real_display_name(StreamInteractor stream_interactor, Account account, Jid jid, string? self_word = null) {
if (jid.equals_bare(account.bare_jid)) { if (jid.equals_bare(account.bare_jid)) {
if (self_word != null || account.alias == null || account.alias.length == 0) { if (self_word != null && (account.alias == null || account.alias.length == 0)) {
return self_word; return self_word;
} }
return account.alias; return account.alias;

View file

@ -181,7 +181,7 @@ public class ConversationItemSkeleton : Plugins.ConversationItemWidgetInterface,
} }
private void update_name_label() { private void update_name_label() {
name_label.label = Util.get_participant_display_name(stream_interactor, conversation, item.jid); name_label.label = Util.get_participant_display_name(stream_interactor, conversation, item.jid, true);
} }
private void update_received_mark() { private void update_received_mark() {