diff options
author | Anmol <godofwaranmol@gmail.com> | 2020-04-22 23:34:03 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-22 20:04:03 +0200 |
commit | 2631a9bdbaf9a40f329f05c55c6e2ea38efeb10c (patch) | |
tree | dfe6b0b3a390457b1c7d125b81a5c1d10019281c /main/src/ui/occupant_menu | |
parent | 51a23728694a3f1312cc9396fc093ca178457c3c (diff) | |
download | dino-2631a9bdbaf9a40f329f05c55c6e2ea38efeb10c.tar.gz dino-2631a9bdbaf9a40f329f05c55c6e2ea38efeb10c.zip |
voice handling in moderated groups (#788)
Diffstat (limited to 'main/src/ui/occupant_menu')
-rw-r--r-- | main/src/ui/occupant_menu/view.vala | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/main/src/ui/occupant_menu/view.vala b/main/src/ui/occupant_menu/view.vala index 958a4aa3..a512ff24 100644 --- a/main/src/ui/occupant_menu/view.vala +++ b/main/src/ui/occupant_menu/view.vala @@ -97,6 +97,21 @@ public class View : Popover { outer_box.add(kick_button); kick_button.clicked.connect(kick_button_clicked); } + if (stream_interactor.get_module(MucManager.IDENTITY).is_moderated_room(conversation.account, conversation.counterpart) && role == Xmpp.Xep.Muc.Role.MODERATOR){ + if (stream_interactor.get_module(MucManager.IDENTITY).get_role(selected_jid, conversation.account) == Xmpp.Xep.Muc.Role.VISITOR) { + ModelButton voice_button = new ModelButton() { active=true, text=_("Grant write permission"), visible=true }; + outer_box.add(voice_button); + voice_button.clicked.connect(() => + voice_button_clicked("participant")); + } + else if (stream_interactor.get_module(MucManager.IDENTITY).get_role(selected_jid, conversation.account) == Xmpp.Xep.Muc.Role.PARTICIPANT){ + ModelButton voice_button = new ModelButton() { active=true, text=_("Revoke write permission"), visible=true }; + outer_box.add(voice_button); + voice_button.clicked.connect(() => + voice_button_clicked("visitor")); + } + + } if (jid_menu != null) jid_menu.destroy(); stack.add_named(outer_box, "menu"); @@ -119,6 +134,12 @@ public class View : Popover { stream_interactor.get_module(MucManager.IDENTITY).kick(conversation.account, conversation.counterpart, selected_jid.resourcepart); } + + private void voice_button_clicked(string role) { + if (selected_jid == null) return; + + stream_interactor.get_module(MucManager.IDENTITY).change_role(conversation.account, conversation.counterpart, selected_jid.resourcepart, role); + } } } |