aboutsummaryrefslogtreecommitdiff
path: root/main/src/ui/occupant_menu
diff options
context:
space:
mode:
authorMarvin W <git@larma.de>2019-10-18 16:52:29 +0200
committerMarvin W <git@larma.de>2019-10-18 16:52:29 +0200
commite330e60f83e6e46bbc3d320711709f2448b802e7 (patch)
tree9caf36bae3326e711fe113336985e80e7218b3d5 /main/src/ui/occupant_menu
parentde3af0ae24b70ccb7670fa236076c061316f03cb (diff)
downloaddino-e330e60f83e6e46bbc3d320711709f2448b802e7.tar.gz
dino-e330e60f83e6e46bbc3d320711709f2448b802e7.zip
Base avatars and names on conversation, not JID.
Fixes #598
Diffstat (limited to 'main/src/ui/occupant_menu')
-rw-r--r--main/src/ui/occupant_menu/list.vala10
-rw-r--r--main/src/ui/occupant_menu/list_row.vala10
-rw-r--r--main/src/ui/occupant_menu/view.vala2
3 files changed, 11 insertions, 11 deletions
diff --git a/main/src/ui/occupant_menu/list.vala b/main/src/ui/occupant_menu/list.vala
index f31ada93..4abc3636 100644
--- a/main/src/ui/occupant_menu/list.vala
+++ b/main/src/ui/occupant_menu/list.vala
@@ -57,7 +57,7 @@ public class List : Box {
}
public void add_occupant(Jid jid) {
- rows[jid] = new ListRow(stream_interactor, conversation.account, jid);
+ rows[jid] = new ListRow(stream_interactor, conversation, jid);
list_box.add(rows[jid]);
}
@@ -83,12 +83,12 @@ public class List : Box {
private void header(ListBoxRow row, ListBoxRow? before_row) {
ListRow c1 = row as ListRow;
- Xmpp.Xep.Muc.Affiliation? a1 = stream_interactor.get_module(MucManager.IDENTITY).get_affiliation(conversation.counterpart, c1.jid, c1.account);
+ Xmpp.Xep.Muc.Affiliation? a1 = stream_interactor.get_module(MucManager.IDENTITY).get_affiliation(conversation.counterpart, c1.jid, c1.conversation.account);
if (a1 == null) return;
if (before_row != null) {
ListRow c2 = (ListRow) before_row;
- Xmpp.Xep.Muc.Affiliation? a2 = stream_interactor.get_module(MucManager.IDENTITY).get_affiliation(conversation.counterpart, c2.jid, c2.account);
+ Xmpp.Xep.Muc.Affiliation? a2 = stream_interactor.get_module(MucManager.IDENTITY).get_affiliation(conversation.counterpart, c2.jid, c2.conversation.account);
if (a1 != a2) {
row.set_header(generate_header_widget(a1, false));
} else if (row.get_header() != null){
@@ -145,8 +145,8 @@ public class List : Box {
if (row1.get_type().is_a(typeof(ListRow)) && row2.get_type().is_a(typeof(ListRow))) {
ListRow c1 = row1 as ListRow;
ListRow c2 = row2 as ListRow;
- int affiliation1 = get_affiliation_ranking(stream_interactor.get_module(MucManager.IDENTITY).get_affiliation(conversation.counterpart, c1.jid, c1.account) ?? Xmpp.Xep.Muc.Affiliation.NONE);
- int affiliation2 = get_affiliation_ranking(stream_interactor.get_module(MucManager.IDENTITY).get_affiliation(conversation.counterpart, c2.jid, c2.account) ?? Xmpp.Xep.Muc.Affiliation.NONE);
+ int affiliation1 = get_affiliation_ranking(stream_interactor.get_module(MucManager.IDENTITY).get_affiliation(conversation.counterpart, c1.jid, c1.conversation.account) ?? Xmpp.Xep.Muc.Affiliation.NONE);
+ int affiliation2 = get_affiliation_ranking(stream_interactor.get_module(MucManager.IDENTITY).get_affiliation(conversation.counterpart, c2.jid, c2.conversation.account) ?? Xmpp.Xep.Muc.Affiliation.NONE);
if (affiliation1 < affiliation2) return -1;
else if (affiliation1 > affiliation2) return 1;
else return c1.name_label.label.collate(c2.name_label.label);
diff --git a/main/src/ui/occupant_menu/list_row.vala b/main/src/ui/occupant_menu/list_row.vala
index 0827ae35..92fff32f 100644
--- a/main/src/ui/occupant_menu/list_row.vala
+++ b/main/src/ui/occupant_menu/list_row.vala
@@ -11,15 +11,15 @@ public class ListRow : ListBoxRow {
[GtkChild] private AvatarImage image;
[GtkChild] public Label name_label;
- public Account? account;
+ public Conversation? conversation;
public Jid? jid;
- public ListRow(StreamInteractor stream_interactor, Account account, Jid jid) {
- this.account = account;
+ public ListRow(StreamInteractor stream_interactor, Conversation conversation, Jid jid) {
+ this.conversation = conversation;
this.jid = jid;
- name_label.label = Util.get_display_name(stream_interactor, jid, account);
- image.set_jid(stream_interactor, jid, account);
+ name_label.label = Util.get_participant_display_name(stream_interactor, conversation, jid);
+ image.set_conversation_participant(stream_interactor, conversation, jid);
}
public ListRow.label(string c, string text) {
diff --git a/main/src/ui/occupant_menu/view.vala b/main/src/ui/occupant_menu/view.vala
index 119d7cfe..defc2e1c 100644
--- a/main/src/ui/occupant_menu/view.vala
+++ b/main/src/ui/occupant_menu/view.vala
@@ -105,7 +105,7 @@ public class View : Popover {
ListRow? list_row = list.list_box.get_selected_row() as ListRow;
if (list_row == null) return;
- Conversation conversation = stream_interactor.get_module(ConversationManager.IDENTITY).create_conversation(list_row.jid, list_row.account, Conversation.Type.GROUPCHAT_PM);
+ Conversation conversation = stream_interactor.get_module(ConversationManager.IDENTITY).create_conversation(list_row.jid, list_row.conversation.account, Conversation.Type.GROUPCHAT_PM);
stream_interactor.get_module(ConversationManager.IDENTITY).start_conversation(conversation);
}