aboutsummaryrefslogtreecommitdiff
path: root/main/src/ui/util
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2018-12-04 10:21:24 +0100
committerfiaxh <fiaxh@users.noreply.github.com>2018-12-28 13:42:58 +0100
commitd8e0ab406cdad73edf79123e84d0013b96a3963a (patch)
tree4de13499d19113f96b5720a0554f95a3feb707b7 /main/src/ui/util
parent965f4da75ae5a5b308191bd61890b4277504f5b1 (diff)
downloaddino-d8e0ab406cdad73edf79123e84d0013b96a3963a.tar.gz
dino-d8e0ab406cdad73edf79123e84d0013b96a3963a.zip
display groups w/o name by list of members
For members-only, non-anonymous groups that do not have a name set we now show an automatically generated name that is generated from the list of members (offline, and online). Only the first name (before the first space) is used to keep the generated name short. The term *private room* is coined as a short hand for members only&non-anon group chats. This commit also uses the offline members list instead of the online member list to generate avatar tiles (also only in members-only, non-anon groups.)
Diffstat (limited to 'main/src/ui/util')
-rw-r--r--main/src/ui/util/helper.vala17
1 files changed, 16 insertions, 1 deletions
diff --git a/main/src/ui/util/helper.vala b/main/src/ui/util/helper.vala
index 2f2bb84d..da854513 100644
--- a/main/src/ui/util/helper.vala
+++ b/main/src/ui/util/helper.vala
@@ -60,10 +60,25 @@ 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(jid, account)) {
- string room_name = stream_interactor.get_module(MucManager.IDENTITY).get_room_name(account, jid);
+ MucManager muc_manager = stream_interactor.get_module(MucManager.IDENTITY);
+ string room_name = muc_manager.get_room_name(account, jid);
if (room_name != null && room_name != jid.localpart) {
return room_name;
}
+ if (muc_manager.is_private_room(account, jid)) {
+ Gee.List<Jid>? other_occupants = muc_manager.get_other_offline_members(jid, account);
+ if (other_occupants != null && other_occupants.size > 0) {
+ var builder = new StringBuilder ();
+ foreach(Jid occupant in other_occupants) {
+
+ if (builder.len != 0) {
+ builder.append(", ");
+ }
+ builder.append(get_display_name(stream_interactor, occupant, account).split(" ")[0]);
+ }
+ return builder.str;
+ }
+ }
return jid.bare_jid.to_string();
} else if (stream_interactor.get_module(MucManager.IDENTITY).is_groupchat_occupant(jid, account)) {
return jid.resourcepart;