diff options
| author | fiaxh <git@lightrise.org> | 2025-09-17 17:47:36 +0200 |
|---|---|---|
| committer | fiaxh <git@lightrise.org> | 2025-09-17 17:47:36 +0200 |
| commit | d625058d76efc9e344dd5e1239a4b040a7d2519a (patch) | |
| tree | 4b5a6dc6ad05cb96f58014d1f8740f632efa4bdc /libdino/src/entity/message.vala | |
| parent | fa678bd2cf60ebdcda652794bfb5e06b7bd7917f (diff) | |
Message correction: Use occupant ids, handle correction-before-message
Diffstat (limited to 'libdino/src/entity/message.vala')
| -rw-r--r-- | libdino/src/entity/message.vala | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/libdino/src/entity/message.vala b/libdino/src/entity/message.vala index 4de17125..0d53fd70 100644 --- a/libdino/src/entity/message.vala +++ b/libdino/src/entity/message.vala @@ -46,6 +46,7 @@ public class Message : Object { } public bool direction { get; set; } public Jid? real_jid { get; set; } + public int occupant_db_id { get; set; default=-1; } public Type type_ { get; set; default = Type.UNKNOWN; } private string? body_; public string? body { @@ -105,9 +106,12 @@ public class Message : Object { body = row[db.message.body]; marked = (Message.Marked) row[db.message.marked]; encryption = (Encryption) row[db.message.encryption]; + string? real_jid_str = row[db.real_jid.real_jid]; if (real_jid_str != null) real_jid = new Jid(real_jid_str); + occupant_db_id = row[db.message_occupant_id.occupant_id]; + edit_to = row[db.message_correction.to_stanza_id]; quoted_item_id = row[db.reply.quoted_content_item_id]; @@ -140,6 +144,13 @@ public class Message : Object { .value(db.real_jid.real_jid, real_jid.to_string()) .perform(); } + + if (occupant_db_id != -1) { + db.message_occupant_id.insert() + .value(db.message_occupant_id.occupant_id, occupant_db_id) + .value(db.message_occupant_id.message_id, id) + .perform(); + } notify.connect(on_update); } @@ -320,6 +331,13 @@ public class Message : Object { .value(db.reply.quoted_content_item_id, quoted_item_id) .perform(); } + + if (sp.get_name() == "message-occupant-id" && occupant_db_id != -1) { + db.message_occupant_id.upsert() + .value(db.message_occupant_id.occupant_id, occupant_db_id, true) + .value(db.message_occupant_id.message_id, id) + .perform(); + } } } |
