blob: c7ea4a1ce8cc7241ca4a58881e17e1b71ddbe160 (
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
|
using Gtk;
using Dino.Entities;
namespace Dino.Ui.ContactDetails {
public class PermissionsProvider : Plugins.ContactDetailsProvider, Object {
public string id { get { return "permissions"; } }
private StreamInteractor stream_interactor;
public PermissionsProvider(StreamInteractor stream_interactor) {
this.stream_interactor = stream_interactor;
}
public void populate(Conversation conversation, Plugins.ContactDetails contact_details, Plugins.WidgetType type) {
if (type != Plugins.WidgetType.GTK4) return;
Xmpp.Jid? own_jid = stream_interactor.get_module(MucManager.IDENTITY).get_own_jid(conversation.counterpart, conversation.account);
if (own_jid == null) return;
if (stream_interactor.get_module(MucManager.IDENTITY).get_role(own_jid, conversation.account) == Xmpp.Xep.Muc.Role.VISITOR){
Button voice_request = new Button.with_label(_("Request"));
voice_request.clicked.connect(()=>stream_interactor.get_module(MucManager.IDENTITY).request_voice(conversation.account, conversation.counterpart));
contact_details.add("Permissions", _("Request permission to send messages"), "", voice_request);
}
}
}
}
|