summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2021-05-21 19:06:23 +0200
committerEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2021-05-21 19:06:23 +0200
commit6c0be6952407ed8f191a6e1f72f91181d3cee5ba (patch)
treec5219166ec86051f6119bc09ab8ac0de02869be2
parent2b032b7d02dadcdd25cb8baea6a7854522745c2f (diff)
downloadpoezio-6c0be6952407ed8f191a6e1f72f91181d3cee5ba.tar.gz
poezio-6c0be6952407ed8f191a6e1f72f91181d3cee5ba.tar.bz2
poezio-6c0be6952407ed8f191a6e1f72f91181d3cee5ba.tar.xz
poezio-6c0be6952407ed8f191a6e1f72f91181d3cee5ba.zip
muctab: Add a /request_voice for use in moderated rooms
It signals moderators that you want to speak.
-rw-r--r--poezio/tabs/muctab.py42
1 files changed, 42 insertions, 0 deletions
diff --git a/poezio/tabs/muctab.py b/poezio/tabs/muctab.py
index 3d9c2317..a61d108e 100644
--- a/poezio/tabs/muctab.py
+++ b/poezio/tabs/muctab.py
@@ -1795,6 +1795,30 @@ class MucTab(ChatTab):
self.ignores.remove(user)
self.core.information('%s is now unignored' % nick)
+ @command_args_parser.quoted(0, 1)
+ def command_request_voice(self, args: List[str]) -> None:
+ """
+ /request_voice [role]
+ Request voice in a moderated room
+ role can be: participant, moderator
+ """
+
+ room = JID(self.name)
+ if not room:
+ self.core.information('request_voice: requires a valid chat address', 'Error')
+ return
+
+ if len(args) > 1:
+ self.core.command.help('request_voice')
+ return
+
+ if args:
+ role = args[0]
+ else:
+ role = 'participant'
+
+ self.core.xmpp['xep_0045'].request_voice(room, role)
+
########################## COMPLETIONS #################################
def completion(self) -> None:
@@ -1965,6 +1989,11 @@ class MucTab(ChatTab):
return Completion(the_input.auto_completion, users, quotify=False)
return None
+ def completion_request_voice(self, the_input: windows.MessageInput) -> Optional[Completion]:
+ """Completion for /request_voice"""
+ allowed = ['participant', 'moderator']
+ return Completion(the_input.auto_completion, allowed, quotify=False)
+
########################## REGISTER STUFF ##############################
@@ -2234,6 +2263,19 @@ class MucTab(ChatTab):
'Invite a contact to this room',
'completion':
self.completion_invite
+ }, {
+ 'name':
+ 'request_voice',
+ 'func':
+ self.command_request_voice,
+ 'desc':
+ 'Request voice when we are a visitor in a moderated room',
+ 'usage':
+ '[role]',
+ 'shortdesc':
+ 'Request voice in a moderated room',
+ 'completion':
+ self.completion_request_voice
}])