From dc52e7595cca06d0a2da7d11b3c88cb2f7ce529c Mon Sep 17 00:00:00 2001 From: fiaxh Date: Fri, 6 Jan 2023 13:19:42 +0100 Subject: Add support for XEP-0461 replies (with fallback) --- libdino/src/service/database.vala | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) (limited to 'libdino/src/service/database.vala') diff --git a/libdino/src/service/database.vala b/libdino/src/service/database.vala index 5f422d2f..bfd85f06 100644 --- a/libdino/src/service/database.vala +++ b/libdino/src/service/database.vala @@ -7,7 +7,7 @@ using Dino.Entities; namespace Dino { public class Database : Qlite.Database { - private const int VERSION = 23; + private const int VERSION = 24; public class AccountTable : Table { public Column id = new Column.Integer("id") { primary_key = true, auto_increment = true }; @@ -97,6 +97,20 @@ public class Database : Qlite.Database { } } + public class BodyMeta : Table { + public Column id = new Column.Integer("id") { primary_key = true, auto_increment = true }; + public Column message_id = new Column.Integer("message_id"); + public Column from_char = new Column.Integer("from_char"); + public Column to_char = new Column.Integer("to_char"); + public Column info_type = new Column.Text("info_type"); + public Column info = new Column.Text("info"); + + internal BodyMeta(Database db) { + base(db, "body_meta"); + init({id, message_id, from_char, to_char, info_type, info}); + } + } + public class MessageCorrectionTable : Table { public Column id = new Column.Integer("id") { primary_key = true, auto_increment = true }; public Column message_id = new Column.Integer("message_id") { unique=true }; @@ -109,6 +123,20 @@ public class Database : Qlite.Database { } } + public class ReplyTable : Table { + public Column id = new Column.Integer("id") { primary_key = true, auto_increment = true }; + public Column message_id = new Column.Integer("message_id") { not_null = true, unique=true }; + public Column quoted_content_item_id = new Column.Integer("quoted_message_id"); + public Column quoted_message_stanza_id = new Column.Text("quoted_message_stanza_id"); + public Column quoted_message_from = new Column.Text("quoted_message_from"); + + internal ReplyTable(Database db) { + base(db, "reply"); + init({id, message_id, quoted_content_item_id, quoted_message_stanza_id, quoted_message_from}); + index("reply_quoted_message_stanza_id", {quoted_message_stanza_id}); + } + } + public class RealJidTable : Table { public Column message_id = new Column.Integer("message_id") { primary_key = true }; public Column real_jid = new Column.Text("real_jid"); @@ -337,6 +365,8 @@ public class Database : Qlite.Database { public EntityTable entity { get; private set; } public ContentItemTable content_item { get; private set; } public MessageTable message { get; private set; } + public BodyMeta body_meta { get; private set; } + public ReplyTable reply { get; private set; } public MessageCorrectionTable message_correction { get; private set; } public RealJidTable real_jid { get; private set; } public OccupantIdTable occupantid { get; private set; } @@ -364,7 +394,9 @@ public class Database : Qlite.Database { entity = new EntityTable(this); content_item = new ContentItemTable(this); message = new MessageTable(this); + body_meta = new BodyMeta(this); message_correction = new MessageCorrectionTable(this); + reply = new ReplyTable(this); occupantid = new OccupantIdTable(this); real_jid = new RealJidTable(this); file_transfer = new FileTransferTable(this); @@ -379,7 +411,7 @@ public class Database : Qlite.Database { reaction = new ReactionTable(this); settings = new SettingsTable(this); conversation_settings = new ConversationSettingsTable(this); - init({ account, jid, entity, content_item, message, message_correction, real_jid, occupantid, file_transfer, call, call_counterpart, conversation, avatar, entity_identity, entity_feature, roster, mam_catchup, reaction, settings, conversation_settings }); + init({ account, jid, entity, content_item, message, body_meta, message_correction, reply, real_jid, occupantid, file_transfer, call, call_counterpart, conversation, avatar, entity_identity, entity_feature, roster, mam_catchup, reaction, settings, conversation_settings }); try { exec("PRAGMA journal_mode = WAL"); -- cgit v1.2.3-54-g00ecf