aboutsummaryrefslogtreecommitdiff
path: root/libdino/src
diff options
context:
space:
mode:
Diffstat (limited to 'libdino/src')
-rw-r--r--libdino/src/entity/message.vala5
-rw-r--r--libdino/src/service/message_processor.vala1
2 files changed, 3 insertions, 3 deletions
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);
}