summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxime “pep” Buquet <pep@bouah.net>2019-04-07 23:52:30 +0100
committerMaxime “pep” Buquet <pep@bouah.net>2019-04-07 23:52:30 +0100
commita21335ac171a827a613dcce744898e822689c9d3 (patch)
treef07d9af1d0e504adea718fa93e8a3736efa344f8
parente256c31875c8b67d85fe30d3e2c14c896066657a (diff)
downloadpoezio-a21335ac171a827a613dcce744898e822689c9d3.tar.gz
poezio-a21335ac171a827a613dcce744898e822689c9d3.tar.bz2
poezio-a21335ac171a827a613dcce744898e822689c9d3.tar.xz
poezio-a21335ac171a827a613dcce744898e822689c9d3.zip
Remove more safeJID calls
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
-rw-r--r--poezio/core/commands.py9
-rw-r--r--poezio/core/core.py2
-rw-r--r--poezio/tabs/basetabs.py6
3 files changed, 11 insertions, 6 deletions
diff --git a/poezio/core/commands.py b/poezio/core/commands.py
index f7946b71..242b60a3 100644
--- a/poezio/core/commands.py
+++ b/poezio/core/commands.py
@@ -1024,14 +1024,17 @@ class CommandCore:
"""
if args is None:
return self.help('message')
- jid = safeJID(args[0])
- if not jid.user and not jid.domain and not jid.resource:
+ try:
+ jid = JID(args[0])
+ except InvalidJID:
+ return self.core.information('Invalid JID.', 'Error')
+ if not jid.bare:
return self.core.information('Invalid JID.', 'Error')
tab = self.core.get_conversation_by_jid(
jid.full, False, fallback_barejid=False)
muc = self.core.tabs.by_name_and_class(jid.bare, tabs.MucTab)
if not tab and not muc:
- tab = self.core.open_conversation_window(jid.full, focus=True)
+ tab = self.core.open_conversation_window(jid, focus=True)
elif muc:
if jid.resource:
tab = self.core.tabs.by_name_and_class(jid.full,
diff --git a/poezio/core/core.py b/poezio/core/core.py
index 91eb4877..2e0e0acb 100644
--- a/poezio/core/core.py
+++ b/poezio/core/core.py
@@ -1164,7 +1164,7 @@ class Core:
provided, we open a StaticConversationTab, else a
DynamicConversationTab
"""
- if safeJID(jid).resource:
+ if jid.resource:
new_tab = tabs.StaticConversationTab(self, jid)
else:
new_tab = tabs.DynamicConversationTab(self, jid)
diff --git a/poezio/tabs/basetabs.py b/poezio/tabs/basetabs.py
index 5dc94ff8..c6d8b6b6 100644
--- a/poezio/tabs/basetabs.py
+++ b/poezio/tabs/basetabs.py
@@ -534,7 +534,9 @@ class ChatTab(Tab):
"""
Log the messages in the archives.
"""
- name = safeJID(self.name).bare
+ if self.name is None:
+ return None
+ name = self.name.bare
if not logger.log_message(name, nickname, txt, date=time, typ=typ):
self.core.information('Unable to write in the log file', 'Error')
@@ -811,7 +813,7 @@ class OneToOneTab(ChatTab):
return
self.__status = status
hide_status_change = config.get_by_tabname('hide_status_change',
- safeJID(self.name).bare)
+ self.name.bare)
now = datetime.now()
dff = now - self.last_remote_message
if hide_status_change > -1 and dff.total_seconds() > hide_status_change: