summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxime “pep” Buquet <pep@bouah.net>2020-05-31 17:23:29 +0200
committerMaxime “pep” Buquet <pep@bouah.net>2020-06-24 19:21:19 +0200
commit99df5f5f23bbf52b87cf3d589c8691c04fe1167e (patch)
treec12569f9c258db2d905c9c041713a60b4c57d681
parentfd74f8cce5d5cdd877610eaa5ba4457202b237d4 (diff)
downloadpoezio-99df5f5f23bbf52b87cf3d589c8691c04fe1167e.tar.gz
poezio-99df5f5f23bbf52b87cf3d589c8691c04fe1167e.tar.bz2
poezio-99df5f5f23bbf52b87cf3d589c8691c04fe1167e.tar.xz
poezio-99df5f5f23bbf52b87cf3d589c8691c04fe1167e.zip
core/commands: use named parameters in _add_bookmarks to make things explicit
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
-rw-r--r--poezio/core/commands.py28
1 files 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')
-
- if len(args) > 1:
- autojoin = False if args[1].lower() != 'true' else True
- else:
- autojoin = True
+ method = 'remote' if config.get('use_remote_bookmarks') else 'local'
+ autojoin = method == 'local' or \
+ (len(args) > 1 and args[1].lower() == 'true')
- self._add_bookmark(room, nick, autojoin, password, 'remote')
+ self._add_bookmark(room, nick, autojoin, password, method)
def _add_bookmark(
self,