aboutsummaryrefslogtreecommitdiff
path: root/main/src/ui/conversation_selector/groupchat_row.vala
blob: 70b24dfd2114fb5c254ce2c5b2cc5e3a5d2adddc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
using Dino.Entities;

namespace Dino.Ui.ConversationSelector {

public class GroupchatRow : ConversationRow {

    public GroupchatRow(StreamInteractor stream_interactor, Conversation conversation) {
        base(stream_interactor, conversation);
        has_tooltip = true;
        set_tooltip_text(conversation.counterpart.bare_jid.to_string());

        closed.connect(() => {
            stream_interactor.get_module(MucManager.IDENTITY).part(conversation.account, conversation.counterpart);
        });

        stream_interactor.get_module(MucManager.IDENTITY).room_name_set.connect((account, jid, room_name) => {
            if (conversation != null && conversation.counterpart.equals_bare(jid) && conversation.account.equals(account)) {
                update_name_label();
            }
        });
    }

    protected override void update_message_label() {
        base.update_message_label();
        if (last_message != null) {
            nick_label.visible = true;
            nick_label.label = Util.get_message_display_name(stream_interactor, last_message, conversation.account) + ": ";
        }
    }
}

}