From 99df5f5f23bbf52b87cf3d589c8691c04fe1167e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxime=20=E2=80=9Cpep=E2=80=9D=20Buquet?= Date: Sun, 31 May 2020 17:23:29 +0200 Subject: [PATCH] core/commands: use named parameters in _add_bookmarks to make things explicit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Maxime “pep” Buquet --- poezio/core/commands.py | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/poezio/core/commands.py b/poezio/core/commands.py index 5ad4b42c..088189fe 100644 --- a/poezio/core/commands.py +++ b/poezio/core/commands.py @@ -408,7 +408,13 @@ class CommandCore: if config.get('synchronise_open_rooms') and room not in self.core.bookmarks: method = 'remote' if config.get( 'use_remote_bookmarks') else 'local' - self._add_bookmark(room, nick if not config_nick else None, True, password, method) + self._add_bookmark( + room=room, + nick=nick if not config_nick else None, + autojoin=True, + password=password, + method=method, + ) if tab == self.core.tabs.current_tab: tab.refresh() @@ -426,7 +432,13 @@ class CommandCore: room, nick = self._parse_join_jid(args[0] if args else '') password = args[1] if len(args) > 1 else None - self._add_bookmark(room, nick, True, password, 'local') + self._add_bookmark( + room=room, + nick=nick, + autojoin=True, + password=password, + method='local', + ) @command_args_parser.quoted(0, 3) def bookmark(self, args): @@ -439,15 +451,11 @@ class CommandCore: room, nick = self._parse_join_jid(args[0] if args else '') password = args[2] if len(args) > 2 else None - if not config.get('use_remote_bookmarks'): - return self._add_bookmark(room, nick, True, password, 'local') + method = 'remote' if config.get('use_remote_bookmarks') else 'local' + autojoin = method == 'local' or \ + (len(args) > 1 and args[1].lower() == 'true') - if len(args) > 1: - autojoin = False if args[1].lower() != 'true' else True - else: - autojoin = True - - self._add_bookmark(room, nick, autojoin, password, 'remote') + self._add_bookmark(room, nick, autojoin, password, method) def _add_bookmark( self,