add IRCBuffer.find_many_from()
This commit is contained in:
parent
3be9029669
commit
accd127ce5
1 changed files with 8 additions and 2 deletions
|
@ -67,12 +67,18 @@ class Buffer(object):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def find_from(self, nickname: str) -> typing.Optional[BufferLine]:
|
def find_from(self, nickname: str) -> typing.Optional[BufferLine]:
|
||||||
|
return (self.find_many_from(nickname, 1) or [None])[0]
|
||||||
|
def find_many_from(self, nickname: str, max: int
|
||||||
|
) -> typing.List[BufferLine]:
|
||||||
nickname_lower = self.server.irc_lower(nickname)
|
nickname_lower = self.server.irc_lower(nickname)
|
||||||
|
found_lines = []
|
||||||
for line in self._lines:
|
for line in self._lines:
|
||||||
if (not line.from_self
|
if (not line.from_self
|
||||||
and self.server.irc_lower(line.sender) == nickname_lower):
|
and self.server.irc_lower(line.sender) == nickname_lower):
|
||||||
return line
|
found_lines.append(line)
|
||||||
return None
|
if len(found_lines) == max:
|
||||||
|
break
|
||||||
|
return found_lines
|
||||||
|
|
||||||
def skip_next(self):
|
def skip_next(self):
|
||||||
self._skip_next = True
|
self._skip_next = True
|
||||||
|
|
Loading…
Reference in a new issue