From d6e742eb611f28fc2fcfbb67d4246f862df5c1c9 Mon Sep 17 00:00:00 2001 From: fiaxh Date: Tue, 4 Apr 2017 19:55:24 +0200 Subject: Application menu fallback button --- libdino/src/entity/message.vala | 5 +++-- libdino/src/service/message_processor.vala | 1 - 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'libdino') diff --git a/libdino/src/entity/message.vala b/libdino/src/entity/message.vala index 4624aa87..3092627e 100644 --- a/libdino/src/entity/message.vala +++ b/libdino/src/entity/message.vala @@ -24,7 +24,7 @@ public class Message : Object { UNKNOWN } - public int? id { get; set; } + public int id { get; set; default = -1; } public Account account { get; set; } public Jid? counterpart { get; set; } public Jid? ourpart { get; set; } @@ -49,7 +49,6 @@ public class Message : Object { private Database? db; public Message(string? body) { - this.id = -1; this.body = body; } @@ -75,6 +74,8 @@ public class Message : Object { } public void persist(Database db) { + if (id != -1) return; + this.db = db; Qlite.InsertBuilder builder = db.message.insert() .value(db.message.account_id, account.id) diff --git a/libdino/src/service/message_processor.vala b/libdino/src/service/message_processor.vala index 10954672..e8fa3c03 100644 --- a/libdino/src/service/message_processor.vala +++ b/libdino/src/service/message_processor.vala @@ -36,7 +36,6 @@ public class MessageProcessor : StreamInteractionModule, Object { public void send_message(string text, Conversation conversation) { Entities.Message message = create_out_message(text, conversation); stream_interactor.get_module(MessageStorage.IDENTITY).add_message(message, conversation); - message.persist(db); send_xmpp_message(message, conversation); message_sent(message, conversation); } -- cgit v1.2.3-70-g09d2