plugins/lastlog: adapt to use poezio.ui.types

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
Maxime “pep” Buquet 2020-08-09 20:09:50 +02:00
parent 2f60a91b80
commit a5b15eafe0
Signed by: pep
GPG key ID: DEDA74AEECA9D0F2

View file

@ -18,7 +18,7 @@ from datetime import datetime
from poezio.plugin import BasePlugin from poezio.plugin import BasePlugin
from poezio import tabs from poezio import tabs
from poezio.text_buffer import TextBuffer from poezio.text_buffer import TextBuffer
from poezio.ui.types import InfoMessage from poezio.ui.types import Message as PMessage, InfoMessage
def add_line( def add_line(
@ -52,7 +52,7 @@ class Plugin(BasePlugin):
res = [] res = []
add_line(text_buffer, "Lastlog:") add_line(text_buffer, "Lastlog:")
for message in text_buffer.messages: 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: search_re.search(message.txt) is not None:
res.append(message) res.append(message)
add_line(text_buffer, "%s> %s" % (message.nickname, message.txt), message.time) add_line(text_buffer, "%s> %s" % (message.nickname, message.txt), message.time)