diff options
author | Maxime “pep” Buquet <pep@bouah.net> | 2019-10-10 13:45:09 +0200 |
---|---|---|
committer | Maxime “pep” Buquet <pep@bouah.net> | 2019-10-10 13:45:09 +0200 |
commit | 5032905f96f92485e09d1599aeb3266f0d043ca9 (patch) | |
tree | 66ec7cb9c2b5039e3093906e83c793501ff09b8e /plugins | |
parent | 4fa30ca764a79870c3c7d0a557654910ba2e4b87 (diff) | |
download | poezio-5032905f96f92485e09d1599aeb3266f0d043ca9.tar.gz poezio-5032905f96f92485e09d1599aeb3266f0d043ca9.tar.bz2 poezio-5032905f96f92485e09d1599aeb3266f0d043ca9.tar.xz poezio-5032905f96f92485e09d1599aeb3266f0d043ca9.zip |
plugins/lastlog: Display time and nickname
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/lastlog.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/plugins/lastlog.py b/plugins/lastlog.py index 314ca75e..104399b4 100644 --- a/plugins/lastlog.py +++ b/plugins/lastlog.py @@ -12,16 +12,23 @@ """ import re +from typing import Optional +from datetime import datetime + from poezio.plugin import BasePlugin from poezio import tabs from poezio.text_buffer import Message, TextBuffer -def add_line(text_buffer: TextBuffer, text: str) -> None: +def add_line( + text_buffer: TextBuffer, + text: str, + datetime: Optional[datetime] = None, + ) -> None: """Adds a textual entry in the TextBuffer""" text_buffer.add_message( text, - None, # Time + datetime, # Time None, # Nickname None, # Nick Color False, # History @@ -58,7 +65,7 @@ class Plugin(BasePlugin): if message.nickname is not None and \ search_re.search(message.txt) is not None: res.append(message) - add_line(text_buffer, "%s" % (message.txt)) + add_line(text_buffer, "%s> %s" % (message.nickname, message.txt), message.time) add_line(text_buffer, "End of Lastlog") self.api.current_tab().text_win.pos = 0 self.api.current_tab().core.refresh_window() |