summaryrefslogtreecommitdiff
path: root/plugins/lastlog.py
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/lastlog.py')
-rw-r--r--plugins/lastlog.py20
1 files changed, 5 insertions, 15 deletions
diff --git a/plugins/lastlog.py b/plugins/lastlog.py
index 104399b4..1c48fa06 100644
--- a/plugins/lastlog.py
+++ b/plugins/lastlog.py
@@ -5,7 +5,7 @@
# Copyright © 2018 Maxime “pep” Buquet
# Copyright © 2019 Madhur Garg
#
-# Distributed under terms of the zlib license. See the COPYING file.
+# Distributed under terms of the GPL-3.0+ license. See the COPYING file.
"""
Search provided string in the buffer and return all results on the screen
@@ -17,7 +17,8 @@ from datetime import datetime
from poezio.plugin import BasePlugin
from poezio import tabs
-from poezio.text_buffer import Message, TextBuffer
+from poezio.text_buffer import TextBuffer
+from poezio.ui.types import Message as PMessage, InfoMessage
def add_line(
@@ -26,18 +27,7 @@ def add_line(
datetime: Optional[datetime] = None,
) -> None:
"""Adds a textual entry in the TextBuffer"""
- text_buffer.add_message(
- text,
- datetime, # Time
- None, # Nickname
- None, # Nick Color
- False, # History
- None, # User
- False, # Highlight
- None, # Identifier
- None, # str_time
- None, # Jid
- )
+ text_buffer.add_message(InfoMessage(text, time=datetime))
class Plugin(BasePlugin):
@@ -62,7 +52,7 @@ class Plugin(BasePlugin):
res = []
add_line(text_buffer, "Lastlog:")
for message in text_buffer.messages:
- if message.nickname is not None and \
+ if isinstance(message, PMessage) and \
search_re.search(message.txt) is not None:
res.append(message)
add_line(text_buffer, "%s> %s" % (message.nickname, message.txt), message.time)