Commit d35256cc authored by Maxime Buquet's avatar Maxime Buquet

Merge remote-tracking branch 'origin/mr/35'

parents 91eabbd1 f9d34fc7
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
# Copyright © 2018 Maxime “pep” Buquet
# Copyright © 2019 Madhur Garg
# Distributed under terms of the zlib license. See the COPYING file.
Search provided string in the buffer and return all results on the screen
import re
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:
"""Adds a textual entry in the TextBuffer"""
None, # Time
None, # Nickname
None, # Nick Color
False, # History
None, # User
False, # Highlight
None, # Identifier
None, # str_time
None, # Jid
class Plugin(BasePlugin):
"""Lastlog Plugin"""
def init(self):
for tab in tabs.ConversationTab, tabs.PrivateTab, tabs.MucTab:
help='Search <keyword> in the buffer and returns results'
'on the screen')
def command_lastlog(self, input_):
"""Define lastlog command"""
text_buffer = self.api.current_tab()._text_buffer
search_re = re.compile(input_, re.I)
res = []
add_line(text_buffer, "Lastlog:")
for message in text_buffer.messages:
if message.nickname is not None and \ is not None:
add_line(text_buffer, "%s" % (message.txt))
add_line(text_buffer, "End of Lastlog")
self.api.current_tab().text_win.pos = 0
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