From 40a459a83c185905860d1afaecea7fb3e8db2b76 Mon Sep 17 00:00:00 2001 From: jesopo Date: Wed, 27 Nov 2019 12:59:50 +0000 Subject: [PATCH] add Buffer.get_all --- src/IRCBuffer.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/IRCBuffer.py b/src/IRCBuffer.py index c368660b..782a6dc1 100644 --- a/src/IRCBuffer.py +++ b/src/IRCBuffer.py @@ -47,6 +47,14 @@ class Buffer(object): continue return line return None + def get_all(self, for_user: typing.Optional[str]=None): + if not for_user == None: + for line in self._lines: + if self.server.irc_lower(line.sender) == for_user: + yield line + else: + for line in self._lines: + yield line def find(self, pattern: typing.Union[str, typing.Pattern[str]], **kwargs ) -> typing.Optional[BufferLineMatch]: from_self = kwargs.get("from_self", True)