aboutsummaryrefslogtreecommitdiff
path: root/libdino/src
diff options
context:
space:
mode:
authorfiaxh <git@mx.ax.lt>2017-03-17 16:21:07 +0100
committerfiaxh <git@mx.ax.lt>2017-03-18 00:12:27 +0100
commit1eca8c6f67cc63084e5e4cc4b92222b0817f13cc (patch)
tree50b4dd9a753132148db474b6713fa84932a9edd6 /libdino/src
parentd3005bcaca33a8a56725885b4b6388ddc7e8a34f (diff)
downloaddino-1eca8c6f67cc63084e5e4cc4b92222b0817f13cc.tar.gz
dino-1eca8c6f67cc63084e5e4cc4b92222b0817f13cc.zip
Fix message stanza default type
Diffstat (limited to 'libdino/src')
-rw-r--r--libdino/src/service/database.vala14
1 files changed, 8 insertions, 6 deletions
diff --git a/libdino/src/service/database.vala b/libdino/src/service/database.vala
index 953fa0b1..29c6f3ee 100644
--- a/libdino/src/service/database.vala
+++ b/libdino/src/service/database.vala
@@ -282,15 +282,19 @@ public class Database : Qlite.Database {
public bool contains_message(Message query_message, Account account) {
int jid_id = get_jid_id(query_message.counterpart);
- return message.select()
+ QueryBuilder builder = message.select()
.with(message.account_id, "=", account.id)
- .with(message.stanza_id, "=", query_message.stanza_id)
.with(message.counterpart_id, "=", jid_id)
.with(message.counterpart_resource, "=", query_message.counterpart.resourcepart)
.with(message.body, "=", query_message.body)
.with(message.time, "<", (long) query_message.time.add_minutes(1).to_unix())
- .with(message.time, ">", (long) query_message.time.add_minutes(-1).to_unix())
- .count() > 0;
+ .with(message.time, ">", (long) query_message.time.add_minutes(-1).to_unix());
+ if (query_message.stanza_id != null) {
+ builder.with(message.stanza_id, "=", query_message.stanza_id);
+ } else {
+ builder.with_null(message.stanza_id);
+ }
+ return builder.count() > 0;
}
public bool contains_message_by_stanza_id(string stanza_id, Account account) {
@@ -347,8 +351,6 @@ public class Database : Qlite.Database {
.value(conversation.active, new_conversation.active);
if (new_conversation.last_active != null) {
insert.value(conversation.last_active, (long) new_conversation.last_active.to_unix());
- } else {
- insert.value_null(conversation.last_active);
}
new_conversation.id = (int) insert.perform();
new_conversation.notify.connect(on_conversation_update);