add Buffer.get_all

This commit is contained in:
jesopo 2019-11-27 12:59:50 +00:00
parent 2139c99562
commit 40a459a83c

View file

@ -47,6 +47,14 @@ class Buffer(object):
continue continue
return line return line
return None 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 def find(self, pattern: typing.Union[str, typing.Pattern[str]], **kwargs
) -> typing.Optional[BufferLineMatch]: ) -> typing.Optional[BufferLineMatch]:
from_self = kwargs.get("from_self", True) from_self = kwargs.get("from_self", True)