diff options
author | mathieui <mathieui@mathieui.net> | 2014-12-30 19:54:04 +0100 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2014-12-30 19:54:04 +0100 |
commit | 25d2bcbbffd7038163916b48666830c095d20507 (patch) | |
tree | f174d4f4041c3be55c023504d085853374d09138 /src/text_buffer.py | |
parent | 1debbe6a7277e0cdfdda8d3f5430cac3c4411a77 (diff) | |
download | poezio-25d2bcbbffd7038163916b48666830c095d20507.tar.gz poezio-25d2bcbbffd7038163916b48666830c095d20507.tar.bz2 poezio-25d2bcbbffd7038163916b48666830c095d20507.tar.xz poezio-25d2bcbbffd7038163916b48666830c095d20507.zip |
Only graphically ack a message if it was sent by us
Diffstat (limited to 'src/text_buffer.py')
-rw-r--r-- | src/text_buffer.py | 9 |
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) |