poezio/mam: Remove superfluous time format conversions and fix parameter type

Signed-off-by: Maxime Buquet's avatarMaxime “pep” Buquet <pep@bouah.net>
parent 055dcdd1
Pipeline #2406 passed with stages
in 2 minutes and 41 seconds
......@@ -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]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment