From fc6019e3c9b1be5e5b863c262dd11da86134b192 Mon Sep 17 00:00:00 2001 From: Simon Laux Date: Sun, 4 Aug 2019 08:50:58 +0200 Subject: [PATCH] fix sql statement in order to close #163 --- src/dc_chat.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/dc_chat.rs b/src/dc_chat.rs index c8c0d8a14..e9b7dc8ba 100644 --- a/src/dc_chat.rs +++ b/src/dc_chat.rs @@ -781,9 +781,9 @@ unsafe fn get_parent_mime_headers( .sql .query_row( "SELECT rfc724_mid, mime_in_reply_to, mime_references \ - FROM msgs WHERE timestamp=(SELECT max(timestamp) \ + FROM msgs WHERE chat_id=? AND timestamp=(SELECT max(timestamp) \ FROM msgs WHERE chat_id=? AND from_id!=?);", - params![(*chat).id as i32, 1], + params![(*chat).id as i32, (*chat).id as i32, 1], |row| { *parent_rfc724_mid = row.get::<_, String>(0)?.strdup(); *parent_in_reply_to = row.get::<_, String>(1)?.strdup(); @@ -799,9 +799,9 @@ unsafe fn get_parent_mime_headers( .sql .query_row( "SELECT rfc724_mid, mime_in_reply_to, mime_references \ - FROM msgs WHERE timestamp=(SELECT min(timestamp) \ + FROM msgs WHERE chat_id=? AND timestamp=(SELECT min(timestamp) \ FROM msgs WHERE chat_id=? AND from_id==?);", - params![(*chat).id as i32, 1], + params![(*chat).id as i32, (*chat).id as i32, 1], |row| { *parent_rfc724_mid = row.get::<_, String>(0)?.strdup(); *parent_in_reply_to = row.get::<_, String>(1)?.strdup();