From 158cff3098e9370696f9250a199c78e4f2d18ce0 Mon Sep 17 00:00:00 2001 From: Marvin W Date: Sat, 30 May 2026 16:10:36 +0200 Subject: Add JID interning --- libdino/src/entity/account.vala | 6 +++--- libdino/src/entity/message.vala | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'libdino/src/entity') diff --git a/libdino/src/entity/account.vala b/libdino/src/entity/account.vala index e7729fa0..a108af22 100644 --- a/libdino/src/entity/account.vala +++ b/libdino/src/entity/account.vala @@ -10,7 +10,7 @@ public class Account : Object { public string domainpart { get { return full_jid.domainpart; } } public string resourcepart { get { return full_jid.resourcepart; } - private set { full_jid.resourcepart = value; } + private set { full_jid = full_jid.with_resource(value); } } public Jid bare_jid { owned get { return full_jid.bare_jid; } } public Jid full_jid { get; private set; } @@ -37,7 +37,7 @@ public class Account : Object { public Account.from_row(Database db, Qlite.Row row) throws InvalidJidError { this.db = db; id = row[db.account.id]; - full_jid = new Jid(row[db.account.bare_jid]).with_resource(row[db.account.resourcepart]); + full_jid = Jid.from_string(row[db.account.bare_jid]).with_resource(row[db.account.resourcepart]); password = row[db.account.password]; alias = row[db.account.alias]; enabled = row[db.account.enabled]; @@ -82,7 +82,7 @@ public class Account : Object { } public static bool equals_func(Account acc1, Account acc2) { - return acc1.bare_jid.to_string() == acc2.bare_jid.to_string(); + return acc1.bare_jid.equals(acc2.bare_jid); } public static uint hash_func(Account acc) { diff --git a/libdino/src/entity/message.vala b/libdino/src/entity/message.vala index ace59572..16e7ae3f 100644 --- a/libdino/src/entity/message.vala +++ b/libdino/src/entity/message.vala @@ -109,7 +109,7 @@ public class Message : Object { 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); + if (real_jid_str != null) real_jid = Jid.from_string(real_jid_str); occupant_db_id = row[db.message_occupant_id.occupant_id]; -- cgit v1.3