From b63e5f5f9fc0fcd85adf2f93f65d61abd4cc0681 Mon Sep 17 00:00:00 2001 From: Marvin W Date: Fri, 24 Mar 2017 10:40:48 +0100 Subject: Some caching and fix gpgme on some systems --- libdino/src/entity/conversation.vala | 26 +++++++++++++++++--------- libdino/src/entity/message.vala | 4 ++-- 2 files changed, 19 insertions(+), 11 deletions(-) (limited to 'libdino/src/entity') diff --git a/libdino/src/entity/conversation.vala b/libdino/src/entity/conversation.vala index fd226b3e..376d1cef 100644 --- a/libdino/src/entity/conversation.vala +++ b/libdino/src/entity/conversation.vala @@ -74,15 +74,23 @@ public class Conversation : Object { private void on_update(Object o, ParamSpec sp) { var update = db.conversation.update().with(db.conversation.jid_id, "=", db.get_jid_id(counterpart)) - .with(db.conversation.account_id, "=", account.id) - .set(db.conversation.type_, type_) - .set(db.conversation.encryption, encryption) - //.set(conversation.read_up_to, changed_conversation.read_up_to) - .set(db.conversation.active, active); - if (last_active != null) { - update.set(db.conversation.last_active, (long) last_active.to_unix()); - } else { - update.set_null(db.conversation.last_active); + .with(db.conversation.account_id, "=", account.id); + switch (sp.name) { + case "type_": + update.set(db.conversation.type_, type_); break; + case "encryption": + update.set(db.conversation.encryption, encryption); break; + case "read_up_to": + update.set(db.conversation.read_up_to, read_up_to.id); break; + case "active": + update.set(db.conversation.active, active); break; + case "last_active": + if (last_active != null) { + update.set(db.conversation.last_active, (long) last_active.to_unix()); + } else { + update.set_null(db.conversation.last_active); + } + break; } update.perform(); } diff --git a/libdino/src/entity/message.vala b/libdino/src/entity/message.vala index 602c74b6..e50a1fc2 100644 --- a/libdino/src/entity/message.vala +++ b/libdino/src/entity/message.vala @@ -140,7 +140,7 @@ public class Message : Object { private void on_update(Object o, ParamSpec sp) { Qlite.UpdateBuilder update_builder = db.message.update().with(db.message.id, "=", id); - switch (sp.get_name()) { + switch (sp.name) { case "stanza_id": update_builder.set(db.message.stanza_id, stanza_id); break; case "counterpart": @@ -166,7 +166,7 @@ public class Message : Object { update_builder.perform(); if (sp.get_name() == "real_jid") { - db.real_jid.insert() + db.real_jid.insert().or("REPLACE") .value(db.real_jid.message_id, id) .value(db.real_jid.real_jid, real_jid) .perform(); -- cgit v1.2.3-70-g09d2