summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxime “pep” Buquet <pep@bouah.net>2019-09-11 02:30:54 +0200
committerMaxime “pep” Buquet <pep@bouah.net>2019-09-11 02:30:54 +0200
commit31751bcb6198ecc3a2bfc3d21a35be67581d6bac (patch)
tree9fc2f9016c30b5493367866c0e731575077e2401
parent055dcdd1d166a433d843498eb11272654491c115 (diff)
downloadpoezio-31751bcb6198ecc3a2bfc3d21a35be67581d6bac.tar.gz
poezio-31751bcb6198ecc3a2bfc3d21a35be67581d6bac.tar.bz2
poezio-31751bcb6198ecc3a2bfc3d21a35be67581d6bac.tar.xz
poezio-31751bcb6198ecc3a2bfc3d21a35be67581d6bac.zip
poezio/mam: Remove superfluous time format conversions and fix parameter type
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
-rw-r--r--poezio/mam.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/poezio/mam.py b/poezio/mam.py
index e297d555..c42e7a18 100644
--- a/poezio/mam.py
+++ b/poezio/mam.py
@@ -25,13 +25,20 @@ class MAMQueryException(Exception): pass
class NoMAMSupportException(Exception): pass
-def add_line(tab, text_buffer: TextBuffer, text: str, str_time: str, nick: str, top: bool):
+def add_line(
+ tab,
+ text_buffer: TextBuffer,
+ text: str,
+ time: datetime,
+ nick: str,
+ top: bool,
+ ) -> None:
"""Adds a textual entry in the TextBuffer"""
- time = datetime.strftime(str_time, '%Y-%m-%d %H:%M:%S')
- time = datetime.strptime(time, '%Y-%m-%d %H:%M:%S')
+ # Convert to local timezone
time = time.replace(tzinfo=timezone.utc).astimezone(tz=None)
time = time.replace(tzinfo=None)
+
deterministic = config.get_by_tabname('deterministic_nick_colors', tab.jid.bare)
if isinstance(tab, tabs.MucTab):
nick = nick.split('/')[1]