summaryrefslogtreecommitdiff
path: root/src/text_buffer.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/text_buffer.py')
-rw-r--r--src/text_buffer.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/text_buffer.py b/src/text_buffer.py
index 59aa96e1..db68c11f 100644
--- a/src/text_buffer.py
+++ b/src/text_buffer.py
@@ -24,6 +24,9 @@ Message = collections.namedtuple('Message', message_fields)
class CorrectionError(Exception):
pass
+class AckError(Exception):
+ pass
+
def other_elems(self):
"Helper for the repr_message function"
acc = ['Message(']
@@ -161,7 +164,7 @@ class TextBuffer(object):
return i
return -1
- def ack_message(self, old_id):
+ def ack_message(self, old_id, jid):
"""
Ack a message
"""
@@ -169,6 +172,10 @@ class TextBuffer(object):
if i == -1:
return
msg = self.messages[i]
+ if msg.jid != jid:
+ raise AckError('Wrong JID for message id %s (was %s, expected %s)' %
+ (old_id, msg.jid, jid))
+
new_msg = list(msg)
new_msg[12] = True
new_msg = Message(*new_msg)