summaryrefslogtreecommitdiff
path: root/poezio/text_buffer.py
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2019-09-28 18:35:23 +0200
committermathieui <mathieui@mathieui.net>2020-05-09 19:46:17 +0200
commit80ce8453f50ccaad4d71fda8811ee33f5ffa3624 (patch)
tree6e4b7f86f97a82c5fd4cebc6a61349283dee2a36 /poezio/text_buffer.py
parenta5ef6ec9105f22d14b7d7ec3b634796fc3466e93 (diff)
downloadpoezio-80ce8453f50ccaad4d71fda8811ee33f5ffa3624.tar.gz
poezio-80ce8453f50ccaad4d71fda8811ee33f5ffa3624.tar.bz2
poezio-80ce8453f50ccaad4d71fda8811ee33f5ffa3624.tar.xz
poezio-80ce8453f50ccaad4d71fda8811ee33f5ffa3624.zip
Rewrite part of the message handling/rendering
Diffstat (limited to 'poezio/text_buffer.py')
-rw-r--r--poezio/text_buffer.py32
1 files changed, 15 insertions, 17 deletions
diff --git a/poezio/text_buffer.py b/poezio/text_buffer.py
index 1667f0dc..c03f84f5 100644
--- a/poezio/text_buffer.py
+++ b/poezio/text_buffer.py
@@ -63,7 +63,6 @@ class TextBuffer:
highlight: bool = False,
top: Optional[bool] = False,
identifier: Optional[str] = None,
- str_time: Optional[str] = None,
jid: Optional[str] = None,
ack: int = 0) -> int:
"""
@@ -71,14 +70,13 @@ class TextBuffer:
"""
msg = Message(
txt,
- time,
- nickname,
- nick_color,
- history,
- user,
- identifier,
- top,
- str_time=str_time,
+ time=time,
+ nickname=nickname,
+ nick_color=nick_color,
+ history=history,
+ user=user,
+ identifier=identifier,
+ top=top,
highlight=highlight,
jid=jid,
ack=ack)
@@ -180,7 +178,7 @@ class TextBuffer:
if msg.user and msg.user is not user:
raise CorrectionError("Different users")
- elif len(msg.str_time) > 8: # ugly
+ elif msg.history:
raise CorrectionError("Delayed message")
elif not msg.user and (msg.jid is None or jid is None):
raise CorrectionError('Could not check the '
@@ -195,13 +193,13 @@ class TextBuffer:
self.correction_ids[new_id] = orig_id
message = Message(
- txt,
- time,
- msg.nickname,
- msg.nick_color,
- False,
- msg.user,
- orig_id,
+ txt=txt,
+ time=time,
+ nickname=msg.nickname,
+ nick_color=msg.nick_color,
+ history=False,
+ user=msg.user,
+ identifier=orig_id,
highlight=highlight,
old_message=msg,
revisions=msg.revisions + 1,