From 13cef27d46bb8c3c6a274983fc8569752fb69b5d Mon Sep 17 00:00:00 2001 From: fiaxh Date: Sun, 12 Mar 2017 21:22:45 +0100 Subject: Search messages having a uuid stanza id by id + account --- libdino/src/service/database.vala | 3 ++- libdino/src/service/message_manager.vala | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'libdino/src/service') diff --git a/libdino/src/service/database.vala b/libdino/src/service/database.vala index 885a1a8f..953fa0b1 100644 --- a/libdino/src/service/database.vala +++ b/libdino/src/service/database.vala @@ -293,9 +293,10 @@ public class Database : Qlite.Database { .count() > 0; } - public bool contains_message_by_stanza_id(string stanza_id) { + public bool contains_message_by_stanza_id(string stanza_id, Account account) { return message.select() .with(message.stanza_id, "=", stanza_id) + .with(message.account_id, "=", account.id) .count() > 0; } diff --git a/libdino/src/service/message_manager.vala b/libdino/src/service/message_manager.vala index b24aa12d..9f87c932 100644 --- a/libdino/src/service/message_manager.vala +++ b/libdino/src/service/message_manager.vala @@ -115,7 +115,7 @@ public class MessageManager : StreamInteractionModule, Object { pre_message_received(new_message, message, conversation); bool is_uuid = new_message.stanza_id != null && Regex.match_simple("""[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}""", new_message.stanza_id); - if ((is_uuid && !db.contains_message_by_stanza_id(new_message.stanza_id)) || + if ((is_uuid && !db.contains_message_by_stanza_id(new_message.stanza_id, conversation.account)) || (!is_uuid && !db.contains_message(new_message, conversation.account))) { db.add_message(new_message, conversation.account); add_message(new_message, conversation); -- cgit v1.2.3-70-g09d2