aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar jesopo2020-01-17 14:19:46 +0000
committerGravatar jesopo2020-01-17 14:19:46 +0000
commit44644dcd56f297ebe97f7dd03ad27bafaf69181e (patch)
treeda89b69290cb8f089db775ca065541fde9d30f8b
parentgive ever BufferLine an ID (IRCv3 msgid or uuid4()) (diff)
signature
allow BufferLines to be marked as deleted
-rw-r--r--src/IRCBuffer.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/IRCBuffer.py b/src/IRCBuffer.py
index dbd59b3b..a1000f7f 100644
--- a/src/IRCBuffer.py
+++ b/src/IRCBuffer.py
@@ -14,6 +14,7 @@ class BufferLine(object):
method: str
notes: typing.Dict[str, str] = dataclasses.field(
default_factory=dict)
+ deleted: bool=False
class BufferLineMatch(object):
def __init__(self, line: BufferLine, match: str):
@@ -30,11 +31,13 @@ class Buffer(object):
def add(self, line: BufferLine):
self._lines.appendleft(line)
- def get(self, index: int=0, **kwargs) -> typing.Optional[BufferLine]:
- from_self = kwargs.get("from_self", True)
+ def get(self, index: int=0, from_self=True, deleted=False
+ ) -> typing.Optional[BufferLine]:
for line in self._lines:
if line.from_self and not from_self:
continue
+ if line.deleted and not deleted:
+ continue
return line
return None
def get_all(self, for_user: typing.Optional[str]=None):