From 5425243203cbf5f86b33c4014c5aa787c6aae856 Mon Sep 17 00:00:00 2001 From: fiaxh Date: Wed, 9 May 2018 23:19:22 +0200 Subject: Fix empty display names, fix update contact roster name --- libdino/src/service/roster_manager.vala | 6 +++--- main/data/add_conversation/list_row.ui | 1 + main/data/conversation_selector/conversation_row.ui | 1 + main/src/ui/add_conversation/conference_list.vala | 2 +- main/src/ui/util/helper.vala | 5 +---- 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/libdino/src/service/roster_manager.vala b/libdino/src/service/roster_manager.vala index 3c96778d..23bc8b76 100644 --- a/libdino/src/service/roster_manager.vala +++ b/libdino/src/service/roster_manager.vala @@ -55,15 +55,15 @@ public class RosterManager : StreamInteractionModule, Object { } private void on_account_added(Account account) { - stream_interactor.module_manager.get_module(account, Roster.Module.IDENTITY).received_roster.connect( (stream, roster) => { + stream_interactor.module_manager.get_module(account, Roster.Module.IDENTITY).received_roster.connect_after( (stream, roster) => { foreach (Roster.Item roster_item in roster) { on_roster_item_updated(account, roster_item); } }); - stream_interactor.module_manager.get_module(account, Roster.Module.IDENTITY).item_removed.connect( (stream, roster_item) => { + stream_interactor.module_manager.get_module(account, Roster.Module.IDENTITY).item_removed.connect_after( (stream, roster_item) => { removed_roster_item(account, roster_item.jid, roster_item); }); - stream_interactor.module_manager.get_module(account, Roster.Module.IDENTITY).item_updated.connect( (stream, roster_item) => { + stream_interactor.module_manager.get_module(account, Roster.Module.IDENTITY).item_updated.connect_after( (stream, roster_item) => { on_roster_item_updated(account, roster_item); }); } diff --git a/main/data/add_conversation/list_row.ui b/main/data/add_conversation/list_row.ui index 4b3e409f..2eabec11 100644 --- a/main/data/add_conversation/list_row.ui +++ b/main/data/add_conversation/list_row.ui @@ -13,6 +13,7 @@ False 30 30 + center True diff --git a/main/data/conversation_selector/conversation_row.ui b/main/data/conversation_selector/conversation_row.ui index fa5df4e4..3e178c4f 100644 --- a/main/data/conversation_selector/conversation_row.ui +++ b/main/data/conversation_selector/conversation_row.ui @@ -18,6 +18,7 @@ 40 40 + center True diff --git a/main/src/ui/add_conversation/conference_list.vala b/main/src/ui/add_conversation/conference_list.vala index b9f13432..69e8c952 100644 --- a/main/src/ui/add_conversation/conference_list.vala +++ b/main/src/ui/add_conversation/conference_list.vala @@ -85,7 +85,7 @@ internal class ConferenceListRow : ListRow { this.account = account; this.bookmark = bookmark; - name_label.label = bookmark.name ?? bookmark.jid.to_string(); + name_label.label = bookmark.name != null && bookmark.name != "" ? bookmark.name : bookmark.jid.to_string(); if (stream_interactor.get_accounts().size > 1) { via_label.label = "via " + account.bare_jid.to_string(); } else if (bookmark.name != null && bookmark.name != bookmark.jid.to_string()) { diff --git a/main/src/ui/util/helper.vala b/main/src/ui/util/helper.vala index 6d9218e4..3cadfffb 100644 --- a/main/src/ui/util/helper.vala +++ b/main/src/ui/util/helper.vala @@ -60,9 +60,6 @@ public static string get_conversation_display_name(StreamInteractor stream_inter public static string get_display_name(StreamInteractor stream_interactor, Jid jid, Account account) { if (stream_interactor.get_module(MucManager.IDENTITY).is_groupchat_occupant(jid, account)) { - if (jid.resourcepart == account.resourcepart) { - return account.alias; // FIXME temporary. remove again. - } return jid.resourcepart; } else { if (jid.equals_bare(account.bare_jid)) { @@ -73,7 +70,7 @@ public static string get_display_name(StreamInteractor stream_interactor, Jid ji } } Roster.Item roster_item = stream_interactor.get_module(RosterManager.IDENTITY).get_roster_item(account, jid); - if (roster_item != null && roster_item.name != null) { + if (roster_item != null && roster_item.name != null && roster_item.name != "") { return roster_item.name; } return jid.bare_jid.to_string(); -- cgit v1.2.3-70-g09d2