summaryrefslogtreecommitdiff
path: root/poezio/tabs/basetabs.py
diff options
context:
space:
mode:
authorMaxime “pep” Buquet <pep@bouah.net>2019-04-08 13:49:57 +0100
committerMaxime “pep” Buquet <pep@bouah.net>2019-04-08 14:01:09 +0100
commitbf2225468e8f496a45db477b596eb7d233cb813f (patch)
tree86fefa7497fc2d1d9a75442bc993a3b2b50055af /poezio/tabs/basetabs.py
parent6ab49c188a6e5bb95773165f0bdbd672b41c8c81 (diff)
downloadpoezio-bf2225468e8f496a45db477b596eb7d233cb813f.tar.gz
poezio-bf2225468e8f496a45db477b596eb7d233cb813f.tar.bz2
poezio-bf2225468e8f496a45db477b596eb7d233cb813f.tar.xz
poezio-bf2225468e8f496a45db477b596eb7d233cb813f.zip
Revert work on tabs module to change tab.name to JID.
This reverts commits: d693479d05f1ada999c0e29a9d9e2f021dd59e50 2d0cc092fcd154b2d14be0c5ac0ff338607824a0 89a61b84bdb29d3df8c08436c3484fddba8d2ef1 8194d9afbdec2daa1377e07ebb26bb99406473d0 e256c31875c8b67d85fe30d3e2c14c896066657a a21335ac171a827a613dcce744898e822689c9d3 c96e528a8fd1313f75cb792a8e4826fbcfde1bec 0551867bfdb8dfa7dbd5964a15a1a950510e2c71 6ab49c188a6e5bb95773165f0bdbd672b41c8c81
Diffstat (limited to 'poezio/tabs/basetabs.py')
-rw-r--r--poezio/tabs/basetabs.py26
1 files changed, 7 insertions, 19 deletions
diff --git a/poezio/tabs/basetabs.py b/poezio/tabs/basetabs.py
index c6d8b6b6..213f39d7 100644
--- a/poezio/tabs/basetabs.py
+++ b/poezio/tabs/basetabs.py
@@ -20,7 +20,7 @@ from datetime import datetime
from xml.etree import cElementTree as ET
from typing import Any, Callable, Dict, List, Optional
-from slixmpp import JID, InvalidJID, Message
+from slixmpp import JID, Message
from poezio.core.structs import Command, Completion, Status
from poezio import timed_events
@@ -462,16 +462,8 @@ class ChatTab(Tab):
plugin_keys = {} # type: Dict[str, Callable]
message_type = 'chat'
- def __init__(self, core, jid: Optional[JID] = None):
+ def __init__(self, core, jid=''):
Tab.__init__(self, core)
- if jid is not None and not isinstance(jid, JID):
- # XXX: Remove logging once we're more or less sure we've switched
- # all calls.
- log.debug('ChatTab.name: %r: Not a JID object.', jid, exc_info=True)
- try:
- jid = JID(jid)
- except InvalidJID:
- log.debug('ChatTab.name: invalid JID.')
self.name = jid
self.text_win = None
self.directed_presence = None
@@ -522,9 +514,8 @@ class ChatTab(Tab):
raise NotImplementedError
def load_logs(self, log_nb: int) -> Optional[List[Dict[str, Any]]]:
- if self.name is not None:
- return logger.get_logs(self.name.bare, log_nb)
- return None
+ logs = logger.get_logs(safeJID(self.name).bare, log_nb)
+ return logs
def log_message(self,
txt: str,
@@ -534,9 +525,7 @@ class ChatTab(Tab):
"""
Log the messages in the archives.
"""
- if self.name is None:
- return None
- name = self.name.bare
+ name = safeJID(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')
@@ -781,9 +770,8 @@ class ChatTab(Tab):
class OneToOneTab(ChatTab):
- def __init__(self, core, jid: JID):
+ def __init__(self, core, jid=''):
ChatTab.__init__(self, core, jid)
- assert self.name.bare
self.__status = Status("", "")
self.last_remote_message = datetime.now()
@@ -813,7 +801,7 @@ class OneToOneTab(ChatTab):
return
self.__status = status
hide_status_change = config.get_by_tabname('hide_status_change',
- self.name.bare)
+ safeJID(self.name).bare)
now = datetime.now()
dff = now - self.last_remote_message
if hide_status_change > -1 and dff.total_seconds() > hide_status_change: