diff options
author | Maxime “pep” Buquet <pep@bouah.net> | 2019-04-07 22:14:13 +0100 |
---|---|---|
committer | Maxime “pep” Buquet <pep@bouah.net> | 2019-04-07 22:15:40 +0100 |
commit | d693479d05f1ada999c0e29a9d9e2f021dd59e50 (patch) | |
tree | e827a54d626999444549fb454898a892a2a58067 /poezio/tabs/privatetab.py | |
parent | cdd4a99c4522b596288ac006da451e5f89b3b50f (diff) | |
download | poezio-d693479d05f1ada999c0e29a9d9e2f021dd59e50.tar.gz poezio-d693479d05f1ada999c0e29a9d9e2f021dd59e50.tar.bz2 poezio-d693479d05f1ada999c0e29a9d9e2f021dd59e50.tar.xz poezio-d693479d05f1ada999c0e29a9d9e2f021dd59e50.zip |
safeJID: Remove some safeJID calls
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
Diffstat (limited to 'poezio/tabs/privatetab.py')
-rw-r--r-- | poezio/tabs/privatetab.py | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/poezio/tabs/privatetab.py b/poezio/tabs/privatetab.py index cec68ac5..ae34527a 100644 --- a/poezio/tabs/privatetab.py +++ b/poezio/tabs/privatetab.py @@ -20,7 +20,6 @@ from poezio.tabs import OneToOneTab, MucTab, Tab from poezio import windows from poezio import xhtml -from poezio.common import safeJID from poezio.config import config from poezio.core.structs import Command from poezio.decorators import refresh_wrapper @@ -40,10 +39,9 @@ class PrivateTab(OneToOneTab): message_type = 'chat' additional_information = {} # type: Dict[str, Callable[[str], str]] - def __init__(self, core, name, nick): + def __init__(self, core, name: JID, nick: str): OneToOneTab.__init__(self, core, name) self.own_nick = nick - self.name = name self.text_win = windows.TextWin() self._text_buffer.add_window(self.text_win) self.info_header = windows.PrivateInfoWin() @@ -65,13 +63,13 @@ class PrivateTab(OneToOneTab): shortdesc='Get the software version of a jid.') self.resize() self.parent_muc = self.core.tabs.by_name_and_class( - safeJID(name).bare, MucTab) + self.name.bare, MucTab) self.on = True self.update_commands() self.update_keys() def remote_user_color(self): - user = self.parent_muc.get_user_by_name(safeJID(self.name).resource) + user = self.parent_muc.get_user_by_name(self.name.resource) if user: return dump_tuple(user.color) return super().remote_user_color() @@ -105,9 +103,7 @@ class PrivateTab(OneToOneTab): del PrivateTab.additional_information[plugin_name] def load_logs(self, log_nb): - logs = logger.get_logs( - safeJID(self.name).full.replace('/', '\\'), log_nb) - return logs + return logger.get_logs(self.name.full.replace('/', '\\'), log_nb) def log_message(self, txt, nickname, time=None, typ=1): """ @@ -221,7 +217,7 @@ class PrivateTab(OneToOneTab): """ if args: return self.core.command.version(args[0]) - jid = safeJID(self.name) + jid = self.name self.core.xmpp.plugin['xep_0092'].get_version( jid, callback=self.core.handler.on_version_result) @@ -233,7 +229,7 @@ class PrivateTab(OneToOneTab): if arg and arg[0]: self.parent_muc.command_info(arg[0]) else: - user = safeJID(self.name).resource + user = self.name.resource self.parent_muc.command_info(user) def resize(self): @@ -276,7 +272,7 @@ class PrivateTab(OneToOneTab): self.input.refresh() def get_nick(self): - return safeJID(self.name).resource + return self.name.resource def on_input(self, key, raw): if not raw and key in self.key_func: @@ -288,7 +284,7 @@ class PrivateTab(OneToOneTab): empty_after = self.input.get_text() == '' or ( self.input.get_text().startswith('/') and not self.input.get_text().startswith('//')) - tab = self.core.tabs.by_name_and_class(safeJID(self.name).bare, MucTab) + tab = self.core.tabs.by_name_and_class(self.name.bare, MucTab) if tab and tab.joined: self.send_composing_chat_state(empty_after) return False @@ -301,7 +297,7 @@ class PrivateTab(OneToOneTab): self.text_win.remove_line_separator() self.text_win.add_line_separator(self._text_buffer) - tab = self.core.tabs.by_name_and_class(safeJID(self.name).bare, MucTab) + tab = self.core.tabs.by_name_and_class(self.name.bare, MucTab) if tab and tab.joined and config.get_by_tabname( 'send_chat_states', self.general_jid) and self.on: self.send_chat_state('inactive') @@ -310,7 +306,7 @@ class PrivateTab(OneToOneTab): def on_gain_focus(self): self.state = 'current' curses.curs_set(1) - tab = self.core.tabs.by_name_and_class(safeJID(self.name).bare, MucTab) + tab = self.core.tabs.by_name_and_class(self.name.bare, MucTab) if tab and tab.joined and config.get_by_tabname( 'send_chat_states', self.general_jid, @@ -345,7 +341,7 @@ class PrivateTab(OneToOneTab): 'info_col': dump_tuple(get_theme().COLOR_INFORMATION_TEXT) }, typ=2) - new_jid = safeJID(self.name).bare + '/' + user.nick + new_jid = self.name.bare + '/' + user.nick self.name = new_jid return self.core.tabs.current_tab is self @@ -426,7 +422,7 @@ class PrivateTab(OneToOneTab): self.add_message(txt=reason, typ=2) def matching_names(self): - return [(3, safeJID(self.name).resource), (4, self.name)] + return [(3, self.name.resource), (4, self.name)] def add_error(self, error_message): theme = get_theme() |