From c1be52847bae48215a8e5589b3a3b94bc1bb913c Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Thu, 31 Mar 2016 23:24:58 +0100 Subject: Fix core commands, broken in the previous commit. --- plugins/gpg/__init__.py | 6 +- plugins/irc.py | 16 +- plugins/otr.py | 4 +- plugins/ping.py | 2 +- plugins/screen_detach.py | 2 +- plugins/tell.py | 2 +- poezio/core/commands.py | 578 +++++++++++++++++++++-------------------- poezio/core/core.py | 160 +++++------- poezio/tabs/basetabs.py | 2 +- poezio/tabs/conversationtab.py | 4 +- poezio/tabs/muclisttab.py | 2 +- poezio/tabs/muctab.py | 26 +- poezio/tabs/privatetab.py | 2 +- poezio/tabs/rostertab.py | 22 +- poezio/tabs/xmltab.py | 4 +- 15 files changed, 399 insertions(+), 433 deletions(-) diff --git a/plugins/gpg/__init__.py b/plugins/gpg/__init__.py index 0f441653..3e1f8b0b 100644 --- a/plugins/gpg/__init__.py +++ b/plugins/gpg/__init__.py @@ -194,7 +194,7 @@ class Plugin(BasePlugin): that we cannot/do not want to encrypt/decrypt messages. """ current_presence = self.core.get_status() - self.core.command_status('%s %s' % (current_presence.show or 'available', current_presence.message or '',)) + self.core.command.status('%s %s' % (current_presence.show or 'available', current_presence.message or '',)) def on_normal_presence(self, presence): """ @@ -293,7 +293,7 @@ class Plugin(BasePlugin): """ args = args.split() if not args: - return self.core.command_help("gpg") + return self.core.command.help("gpg") if len(args) >= 2: jid = JID(args[1]) else: @@ -313,7 +313,7 @@ class Plugin(BasePlugin): self.contacts[JID(jid).full] = 'disabled' elif command == 'setkey': if len(args) != 3: - return self.core.command_help("gpg") + return self.core.command.help("gpg") if not self.config.has_section('keys'): self.config.add_section('keys') self.config.set(jid.bare, args[2], 'keys') diff --git a/plugins/irc.py b/plugins/irc.py index fe172481..9a67ffe4 100644 --- a/plugins/irc.py +++ b/plugins/irc.py @@ -178,7 +178,7 @@ class Plugin(BasePlugin): rooms = self.config.get_by_tabname('rooms', server, default='').split(':') for room in rooms: room = '{}%{}@{}/{}'.format(room, server, gateway, nick) - self.core.command_join(room) + self.core.command.join(room) def initial_connect(self): gateway = self.config.get('gateway', 'irc.poez.io') @@ -204,7 +204,7 @@ class Plugin(BasePlugin): delayed = self.api.create_delayed_event(5, self.join, gw, sect) self.api.add_timed_event(delayed) if not already_opened: - self.core.command_join(room_suffix + '/' + nick) + self.core.command.join(room_suffix + '/' + nick) delayed = self.api.create_delayed_event(5, login, gateway, section, login_nick, login_command, room_suffix[1:]) @@ -278,7 +278,7 @@ class Plugin(BasePlugin): /irc_join """ if not args: - return self.core.command_help('irc_join') + return self.core.command.help('irc_join') sections = self.config.sections() if 'irc' in sections: sections.remove('irc') @@ -294,7 +294,7 @@ class Plugin(BasePlugin): server. """ if args is None: - return self.core.command_help('irc_query') + return self.core.command.help('irc_query') current_tab_info = self.get_current_tab_irc_info() if not current_tab_info: return @@ -305,9 +305,9 @@ class Plugin(BasePlugin): message = args[1] jid = '{}!{}@{}'.format(nickname, server, gateway) if message: - self.core.command_message('{} "{}"'.format(jid, message)) + self.core.command.message('{} "{}"'.format(jid, message)) else: - self.core.command_message('{}'.format(jid)) + self.core.command.message('{}'.format(jid)) def join_server_rooms(self, section): """ @@ -324,7 +324,7 @@ class Plugin(BasePlugin): suffix = '%{}@{}{}'.format(section, gateway, nick) for room in rooms: - self.core.command_join(room + suffix) + self.core.command.join(room + suffix) def join_room(self, name): """ @@ -339,7 +339,7 @@ class Plugin(BasePlugin): if self.config.get_by_tabname('nickname', server): room += '/' + self.config.get_by_tabname('nickname', server) - self.core.command_join(room) + self.core.command.join(room) def get_current_tab_irc_info(self): """ diff --git a/plugins/otr.py b/plugins/otr.py index 2d59d544..72c80093 100644 --- a/plugins/otr.py +++ b/plugins/otr.py @@ -810,7 +810,7 @@ class Plugin(BasePlugin): """ args = common.shell_split(arg) if not args: - return self.core.command_help('otr') + return self.core.command.help('otr') action = args.pop(0) tab = self.api.current_tab() name = tab.name @@ -920,7 +920,7 @@ class Plugin(BasePlugin): /otrsmp [question] [secret] """ if args is None or not args: - return self.core.command_help('otrsmp') + return self.core.command.help('otrsmp') length = len(args) action = args.pop(0) if length == 2: diff --git a/plugins/ping.py b/plugins/ping.py index c04f085c..fd3d467c 100644 --- a/plugins/ping.py +++ b/plugins/ping.py @@ -58,7 +58,7 @@ class Plugin(BasePlugin): @command_args_parser.raw def command_ping(self, arg): if not arg: - return self.core.command_help('ping') + return self.core.command.help('ping') jid = safeJID(arg) start = time.time() def callback(iq): diff --git a/plugins/screen_detach.py b/plugins/screen_detach.py index 793575d8..e6c02a88 100644 --- a/plugins/screen_detach.py +++ b/plugins/screen_detach.py @@ -99,7 +99,7 @@ class Plugin(BasePlugin, pyinotify.Notifier): if attached != self.attached: self.attached = attached status = 'available' if self.attached else 'away' - self.core.command_status(status) + self.core.command.status(status) if self.config.get('use_csi'): if self.attached: self.core.xmpp.plugin['xep_0352'].send_active() diff --git a/plugins/tell.py b/plugins/tell.py index 16cecacc..76c9d2f0 100644 --- a/plugins/tell.py +++ b/plugins/tell.py @@ -52,7 +52,7 @@ class Plugin(BasePlugin): def command_tell(self, args): """/tell """ if args is None: - self.core.command_help('tell') + self.core.command.help('tell') return nick, msg = args tab = self.api.current_tab() diff --git a/poezio/core/commands.py b/poezio/core/commands.py index 14e09300..a3bbcb42 100644 --- a/poezio/core/commands.py +++ b/poezio/core/commands.py @@ -35,7 +35,7 @@ class CommandCore: self.core = core @command_args_parser.quoted(0, 1) - def command_help(self, args): + def help(self, args): """ /help [command_name] """ @@ -43,27 +43,27 @@ class CommandCore: color = dump_tuple(get_theme().COLOR_HELP_COMMANDS) acc = [] buff = ['Global commands:'] - for command in self.commands: - if isinstance(self.commands[command], Command): + for name, command in enumerate(self.core.commands): + if isinstance(command, Command): acc.append(' \x19%s}%s\x19o - %s' % ( color, - command, - self.commands[command].short_desc)) + name, + command.short_desc)) else: - acc.append(' \x19%s}%s\x19o' % (color, command)) + acc.append(' \x19%s}%s\x19o' % (color, name)) acc = sorted(acc) buff.extend(acc) acc = [] buff.append('Tab-specific commands:') - commands = self.current_tab().commands - for command in commands: - if isinstance(commands[command], Command): + tab_commands = self.core.current_tab().commands + for name, command in enumerate(tab_commands): + if isinstance(command, Command): acc.append(' \x19%s}%s\x19o - %s' % ( color, - command, - commands[command].short_desc)) + name, + command.short_desc)) else: - acc.append(' \x19%s}%s\x19o' % (color, command)) + acc.append(' \x19%s}%s\x19o' % (color, name)) acc = sorted(acc) buff.extend(acc) @@ -72,22 +72,23 @@ class CommandCore: else: command = args[0].lstrip('/').strip() - if command in self.current_tab().commands: - tup = self.current_tab().commands[command] - elif command in self.commands: - tup = self.commands[command] + tab_commands = self.core.current_tab().commands + if command in tab_commands: + tup = tab_commands[command] + elif command in self.core.commands: + tup = self.core.commands[command] else: - self.information('Unknown command: %s' % command, 'Error') + self.core.information('Unknown command: %s' % command, 'Error') return if isinstance(tup, Command): msg = 'Usage: /%s %s\n' % (command, tup.usage) msg += tup.desc else: msg = tup[1] - self.information(msg, 'Help') + self.core.information(msg, 'Help') @command_args_parser.quoted(1) - def command_runkey(self, args): + def runkey(self, args): """ /runkey """ @@ -97,71 +98,71 @@ class CommandCore: return '\n' return key if args is None: - return self.command_help('runkey') + return self.help('runkey') char = args[0] - func = self.key_func.get(char, None) + func = self.core.key_func.get(char, None) if func: func() else: - res = self.do_command(replace_line_breaks(char), False) + res = self.core.do_command(replace_line_breaks(char), False) if res: - self.refresh_window() + self.core.refresh_window() @command_args_parser.quoted(1, 1, [None]) - def command_status(self, args): + def status(self, args): """ /status [msg] """ if args is None: - return self.command_help('status') + return self.help('status') if not args[0] in POSSIBLE_SHOW.keys(): - return self.command_help('status') + return self.help('status') show = POSSIBLE_SHOW[args[0]] msg = args[1] - pres = self.xmpp.make_presence() + pres = self.core.xmpp.make_presence() if msg: pres['status'] = msg pres['type'] = show - self.events.trigger('send_normal_presence', pres) + self.core.events.trigger('send_normal_presence', pres) pres.send() - current = self.current_tab() + current = self.core.current_tab() is_muctab = isinstance(current, tabs.MucTab) if is_muctab and current.joined and show in ('away', 'xa'): current.send_chat_state('inactive') - for tab in self.tabs: + for tab in self.core.tabs: if isinstance(tab, tabs.MucTab) and tab.joined: - muc.change_show(self.xmpp, tab.name, tab.own_nick, show, msg) + muc.change_show(self.core.xmpp, tab.name, tab.own_nick, show, msg) if hasattr(tab, 'directed_presence'): del tab.directed_presence - self.set_status(show, msg) + self.core.set_status(show, msg) if is_muctab and current.joined and show not in ('away', 'xa'): current.send_chat_state('active') @command_args_parser.quoted(1, 2, [None, None]) - def command_presence(self, args): + def presence(self, args): """ /presence [type] [status] """ if args is None: - return self.command_help('presence') + return self.help('presence') jid, type, status = args[0], args[1], args[2] - if jid == '.' and isinstance(self.current_tab(), tabs.ChatTab): - jid = self.current_tab().name + if jid == '.' and isinstance(self.core.current_tab(), tabs.ChatTab): + jid = self.core.current_tab().name if type == 'available': type = None try: - pres = self.xmpp.make_presence(pto=jid, ptype=type, pstatus=status) - self.events.trigger('send_normal_presence', pres) + pres = self.core.xmpp.make_presence(pto=jid, ptype=type, pstatus=status) + self.core.events.trigger('send_normal_presence', pres) pres.send() except: - self.information('Could not send directed presence', 'Error') + self.core.information('Could not send directed presence', 'Error') log.debug('Could not send directed presence to %s', jid, exc_info=True) return - tab = self.get_tab_by_name(jid) + tab = self.core.get_tab_by_name(jid) if tab: if type in ('xa', 'away'): tab.directed_presence = False @@ -169,67 +170,67 @@ class CommandCore: else: tab.directed_presence = True chatstate = 'active' - if tab == self.current_tab(): + if tab == self.core.current_tab(): tab.send_chat_state(chatstate, True) if isinstance(tab, tabs.MucTab): for private in tab.privates: private.directed_presence = tab.directed_presence - if self.current_tab() in tab.privates: - self.current_tab().send_chat_state(chatstate, True) + if self.core.current_tab() in tab.privates: + self.core.current_tab().send_chat_state(chatstate, True) @command_args_parser.quoted(1) - def command_theme(self, args=None): + def theme(self, args=None): """/theme """ if args is None: - return self.command_help('theme') - self.command_set('theme %s' % (args[0],)) + return self.help('theme') + self.set('theme %s' % (args[0],)) @command_args_parser.quoted(1) - def command_win(self, args): + def win(self, args): """ /win """ if args is None: - return self.command_help('win') + return self.help('win') nb = args[0] try: nb = int(nb) except ValueError: pass - if self.current_tab_nb == nb: + if self.core.current_tab_nb == nb: return - self.previous_tab_nb = self.current_tab_nb - old_tab = self.current_tab() + self.core.previous_tab_nb = self.core.current_tab_nb + old_tab = self.core.current_tab() if isinstance(nb, int): - if 0 <= nb < len(self.tabs): - if not self.tabs[nb]: + if 0 <= nb < len(self.core.tabs): + if not self.core.tabs[nb]: return - self.current_tab_nb = nb + self.core.current_tab_nb = nb else: matchs = [] - for tab in self.tabs: + for tab in self.core.tabs: for name in tab.matching_names(): if nb.lower() in name[1].lower(): matchs.append((name[0], tab)) - self.current_tab_nb = tab.nb + self.core.current_tab_nb = tab.nb if not matchs: return tab = min(matchs, key=lambda m: m[0])[1] - self.current_tab_nb = tab.nb + self.core.current_tab_nb = tab.nb old_tab.on_lose_focus() - self.current_tab().on_gain_focus() - self.refresh_window() + self.core.current_tab().on_gain_focus() + self.core.refresh_window() @command_args_parser.quoted(2) - def command_move_tab(self, args): + def move_tab(self, args): """ /move_tab old_pos new_pos """ if args is None: - return self.command_help('move_tab') + return self.help('move_tab') - current_tab = self.current_tab() + current_tab = self.core.current_tab() if args[0] == '.': args[0] = current_tab.nb if args[1] == '.': @@ -242,83 +243,83 @@ class CommandCore: ref = int(value) except ValueError: old_tab = None - for tab in self.tabs: + for tab in self.core.tabs: if not old_tab and value == tab.name: old_tab = tab if not old_tab: - self.information("Tab %s does not exist" % args[0], "Error") + self.core.information("Tab %s does not exist" % args[0], "Error") return None ref = old_tab.nb return ref old = get_nb_from_value(args[0]) new = get_nb_from_value(args[1]) if new is None or old is None: - return self.information('Unable to move the tab.', 'Info') - result = self.insert_tab(old, new) + return self.core.information('Unable to move the tab.', 'Info') + result = self.core.insert_tab(old, new) if not result: - self.information('Unable to move the tab.', 'Info') + self.core.information('Unable to move the tab.', 'Info') else: - self.current_tab_nb = self.tabs.index(current_tab) - self.refresh_window() + self.core.current_tab_nb = self.core.tabs.index(current_tab) + self.core.refresh_window() @command_args_parser.quoted(0, 1) - def command_list(self, args): + def list(self, args): """ /list [server] Opens a MucListTab containing the list of the room in the specified server """ if args is None: - return self.command_help('list') + return self.help('list') elif args: jid = safeJID(args[0]) else: - if not isinstance(self.current_tab(), tabs.MucTab): - return self.information('Please provide a server', 'Error') - jid = safeJID(self.current_tab().name).server + if not isinstance(self.core.current_tab(), tabs.MucTab): + return self.core.information('Please provide a server', 'Error') + jid = safeJID(self.core.current_tab().name).server list_tab = tabs.MucListTab(jid) - self.add_tab(list_tab, True) + self.core.add_tab(list_tab, True) cb = list_tab.on_muc_list_item_received - self.xmpp.plugin['xep_0030'].get_items(jid=jid, - callback=cb) + self.core.xmpp.plugin['xep_0030'].get_items(jid=jid, + callback=cb) @command_args_parser.quoted(1) - def command_version(self, args): + def version(self, args): """ /version """ def callback(res): "Callback for /version" if not res: - return self.information('Could not get the software' - ' version from %s' % jid, - 'Warning') + return self.core.information('Could not get the software' + ' version from %s' % jid, + 'Warning') version = '%s is running %s version %s on %s' % ( jid, res.get('name') or 'an unknown software', res.get('version') or 'unknown', res.get('os') or 'an unknown platform') - self.information(version, 'Info') + self.core.information(version, 'Info') if args is None: - return self.command_help('version') + return self.help('version') jid = safeJID(args[0]) if jid.resource or jid not in roster: - fixes.get_version(self.xmpp, jid, callback=callback) + fixes.get_version(self.core.xmpp, jid, callback=callback) elif jid in roster: for resource in roster[jid].resources: - fixes.get_version(self.xmpp, resource.jid, callback=callback) + fixes.get_version(self.core.xmpp, resource.jid, callback=callback) else: - fixes.get_version(self.xmpp, jid, callback=callback) + fixes.get_version(self.core.xmpp, jid, callback=callback) @command_args_parser.quoted(0, 2) - def command_join(self, args): + def join(self, args): """ /join [room][/nick] [password] """ password = None if len(args) == 0: - tab = self.current_tab() + tab = self.core.current_tab() if not isinstance(tab, (tabs.MucTab, tabs.PrivateTab)): return room = safeJID(tab.name).bare @@ -333,11 +334,11 @@ class CommandCore: if info == '' and len(args[0]) > 1 and args[0][0] == '/': nick = args[0][1:] elif info.resource == '': - nick = self.own_nick + nick = self.core.own_nick else: nick = info.resource if info.bare == '': # happens with /join /nickname, which is OK - tab = self.current_tab() + tab = self.core.current_tab() if not isinstance(tab, tabs.MucTab): return room = tab.name @@ -349,25 +350,25 @@ class CommandCore: # use the server of the current room if available # check if the current room's name has a server if room.find('@') == -1 and not server_root: - if isinstance(self.current_tab(), tabs.MucTab) and\ - self.current_tab().name.find('@') != -1: - domain = safeJID(self.current_tab().name).domain + tab = self.core.current_tab() + if isinstance(tab, tabs.MucTab) and\ + tab.name.find('@') != -1: + domain = safeJID(tab.name).domain room += '@%s' % domain else: room = args[0] room = room.lower() - if room in self.pending_invites: - del self.pending_invites[room] - tab = self.get_tab_by_name(room, tabs.MucTab) + if room in self.core.pending_invites: + del self.core.pending_invites[room] + tab = self.core.get_tab_by_name(room, tabs.MucTab) if tab is not None: - self.focus_tab_named(tab.name) + self.core.focus_tab_named(tab.name) if tab.own_nick == nick and tab.joined: - self.information('/join: Nothing to do.', 'Info') + self.core.information('/join: Nothing to do.', 'Info') else: tab.command_part('') tab.own_nick = nick tab.join() - return if room.startswith('@'): @@ -381,70 +382,71 @@ class CommandCore: tab.password = password tab.join() else: - tab = self.open_new_room(room, nick, password=password) + tab = self.core.open_new_room(room, nick, password=password) tab.join() if tab.joined: - self.enable_private_tabs(room) + self.core.enable_private_tabs(room) tab.state = "normal" - if tab == self.current_tab(): + if tab == self.core.current_tab(): tab.refresh() - self.doupdate() + self.core.doupdate() @command_args_parser.quoted(0, 2) - def command_bookmark_local(self, args): + def bookmark_local(self, args): """ /bookmark_local [room][/nick] [password] """ - if not args and not isinstance(self.current_tab(), tabs.MucTab): + if not args and not isinstance(self.core.current_tab(), tabs.MucTab): return password = args[1] if len(args) > 1 else None jid = args[0] if args else None - _add_bookmark(self, jid, True, password, 'local') + self._add_bookmark(jid, True, password, 'local') @command_args_parser.quoted(0, 3) - def command_bookmark(self, args): + def bookmark(self, args): """ /bookmark [room][/nick] [autojoin] [password] """ - if not args and not isinstance(self.current_tab(), tabs.MucTab): + if not args and not isinstance(self.core.current_tab(), tabs.MucTab): return jid = args[0] if args else '' password = args[2] if len(args) > 2 else None if not config.get('use_remote_bookmarks'): - return _add_bookmark(self, jid, True, password, 'local') + return self._add_bookmark(jid, True, password, 'local') if len(args) > 1: autojoin = False if args[1].lower() != 'true' else True else: autojoin = True - _add_bookmark(self, jid, autojoin, password, 'remote') + self._add_bookmark(jid, autojoin, password, 'remote') def _add_bookmark(self, jid, autojoin, password, method): nick = None if not jid: - tab = self.current_tab() + tab = self.core.current_tab() roomname = tab.name - if tab.joined and tab.own_nick != self.own_nick: + if tab.joined and tab.own_nick != self.core.own_nick: nick = tab.own_nick if password is None and tab.password is not None: password = tab.password elif jid == '*': - return _add_wildcard_bookmarks(self, method) + return self._add_wildcard_bookmarks(method) else: info = safeJID(jid) roomname, nick = info.bare, info.resource if roomname == '': - if not isinstance(self.current_tab(), tabs.MucTab): + tab = self.core.current_tab() + if not isinstance(tab, tabs.MucTab): return - roomname = self.current_tab().name - bookmark = self.bookmarks[roomname] + roomname = tab.name + bookmark = self.core.bookmarks[roomname] if bookmark is None: bookmark = Bookmark(roomname) - self.bookmarks.append(bookmark) + self.core.bookmarks.append(bookmark) bookmark.method = method bookmark.autojoin = autojoin if nick: @@ -453,16 +455,16 @@ class CommandCore: bookmark.password = password def callback(iq): if iq["type"] != "error": - self.information('Bookmark added.', 'Info') + self.core.information('Bookmark added.', 'Info') else: - self.information("Could not add the bookmarks.", "Info") - self.bookmarks.save_local() - self.bookmarks.save_remote(self.xmpp, callback) + self.core.information("Could not add the bookmarks.", "Info") + self.core.bookmarks.save_local() + self.core.bookmarks.save_remote(self.core.xmpp, callback) def _add_wildcard_bookmarks(self, method): new_bookmarks = [] - for tab in self.get_tabs(tabs.MucTab): - bookmark = self.bookmarks[tab.name] + for tab in self.core.get_tabs(tabs.MucTab): + bookmark = self.core.bookmarks[tab.name] if not bookmark: bookmark = Bookmark(tab.name, autojoin=True, method=method) @@ -470,58 +472,58 @@ class CommandCore: else: bookmark.method = method new_bookmarks.append(bookmark) - self.bookmarks.remove(bookmark) - new_bookmarks.extend(self.bookmarks.bookmarks) - self.bookmarks.set(new_bookmarks) + self.core.bookmarks.remove(bookmark) + new_bookmarks.extend(self.core.bookmarks.bookmarks) + self.core.bookmarks.set(new_bookmarks) def _cb(iq): if iq["type"] != "error": - self.information("Bookmarks saved.", "Info") + self.core.information("Bookmarks saved.", "Info") else: - self.information("Could not save the remote bookmarks.", "Info") - self.bookmarks.save_local() - self.bookmarks.save_remote(self.xmpp, _cb) + self.core.information("Could not save the remote bookmarks.", "Info") + self.core.bookmarks.save_local() + self.core.bookmarks.save_remote(self.core.xmpp, _cb) @command_args_parser.ignored - def command_bookmarks(self): + def bookmarks(self): """/bookmarks""" - tab = self.get_tab_by_name('Bookmarks', tabs.BookmarksTab) - old_tab = self.current_tab() + tab = self.core.get_tab_by_name('Bookmarks', tabs.BookmarksTab) + old_tab = self.core.current_tab() if tab: - self.current_tab_nb = tab.nb + self.core.current_tab_nb = tab.nb else: - tab = tabs.BookmarksTab(self.bookmarks) - self.tabs.append(tab) - self.current_tab_nb = tab.nb + tab = tabs.BookmarksTab(self.core.bookmarks) + self.core.tabs.append(tab) + self.core.current_tab_nb = tab.nb old_tab.on_lose_focus() tab.on_gain_focus() - self.refresh_window() + self.core.refresh_window() @command_args_parser.quoted(0, 1) - def command_remove_bookmark(self, args): + def remove_bookmark(self, args): """/remove_bookmark [jid]""" def cb(success): if success: - self.information('Bookmark deleted', 'Info') + self.core.information('Bookmark deleted', 'Info') else: - self.information('Error while deleting the bookmark', 'Error') + self.core.information('Error while deleting the bookmark', 'Error') if not args: - tab = self.current_tab() - if isinstance(tab, tabs.MucTab) and self.bookmarks[tab.name]: - self.bookmarks.remove(tab.name) - self.bookmarks.save(self.xmpp, callback=cb) + tab = self.core.current_tab() + if isinstance(tab, tabs.MucTab) and self.core.bookmarks[tab.name]: + self.core.bookmarks.remove(tab.name) + self.core.bookmarks.save(self.core.xmpp, callback=cb) else: - self.information('No bookmark to remove', 'Info') + self.core.information('No bookmark to remove', 'Info') else: - if self.bookmarks[args[0]]: - self.bookmarks.remove(args[0]) - self.bookmarks.save(self.xmpp, callback=cb) + if self.core.bookmarks[args[0]]: + self.core.bookmarks.remove(args[0]) + self.core.bookmarks.save(self.core.xmpp, callback=cb) else: - self.information('No bookmark to remove', 'Info') + self.core.information('No bookmark to remove', 'Info') @command_args_parser.quoted(0, 3) - def command_set(self, args): + def set(self, args): """ /set [module|][section]