Daniel Brötzmann pushed to branch master at gajim / gajim
Commits:
fb8e2eca by wurstsalat at 2024-04-21T19:17:34+02:00
imprv: ChatCommands: Handle /me command
Fixes #11778
- - - - -
1 changed file:
- gajim/common/commands.py
Changes:
=====================================
gajim/common/commands.py
=====================================
@@ -127,9 +127,6 @@ def add_command(self,
self._commands[command_name] = (used_in, usage)
def parse(self, type_: str, arg_string: str) -> bool:
- if arg_string.startswith('/me '):
- return False
-
if regex.COMMAND_REGEX.match(arg_string) is None:
return False
@@ -156,6 +153,9 @@ def parse(self, type_: str, arg_string: str) -> bool:
self.notify('command-error', str(error))
raise CommandFailed
+ if result == 'silent':
+ return True
+
if result is None:
result = _('Command executed successfully')
@@ -199,6 +199,10 @@ def _create_commands(self) -> None:
choices=['moderator', 'participant', 'visitor'])
self.add_command('role', ['groupchat'], parser)
+ parser = self.make_parser('me', self._me_command)
+ parser.add_argument('message', default=None, nargs='*')
+ self.add_command('me', ['chat', 'groupchat', 'pm'], parser)
+
app.plugin_manager.extension_point('add_commands', self)
def _help_command(self, args: Any) -> str:
@@ -303,3 +307,7 @@ def _kick_command(self, args: Any) -> None:
def _role_command(self, args: Any) -> None:
self._change_role(args.who, args.role, None)
+
+ def _me_command(self, _args: Any) -> str:
+ app.window.activate_action('send-message', None)
+ return 'silent'
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/fb8e2ecaa5f391a0d66c61bb42dda5e94d277300
--
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/fb8e2ecaa5f391a0d66c61bb42dda5e94d277300
You're receiving this email because of your account on dev.gajim.org.
_______________________________________________
Commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]