aboutsummaryrefslogtreecommitdiff
path: root/libdino/src/service/muc_manager.vala
diff options
context:
space:
mode:
authorfiaxh <git@lightrise.org>2022-10-11 13:37:48 +0200
committerfiaxh <git@lightrise.org>2022-10-11 13:37:48 +0200
commit80258a874ddfeb87b4b71f5791eab94a2465de6d (patch)
tree80ef37c3e3c3138d79b3321ee22d185d5a94098e /libdino/src/service/muc_manager.vala
parent6c6e7e3aa7935ec513b7e5ea9b53a92b741ecf92 (diff)
downloaddino-80258a874ddfeb87b4b71f5791eab94a2465de6d.tar.gz
dino-80258a874ddfeb87b4b71f5791eab94a2465de6d.zip
Add support for reactions
Diffstat (limited to 'libdino/src/service/muc_manager.vala')
-rw-r--r--libdino/src/service/muc_manager.vala15
1 files changed, 15 insertions, 0 deletions
diff --git a/libdino/src/service/muc_manager.vala b/libdino/src/service/muc_manager.vala
index 17787387..4505e992 100644
--- a/libdino/src/service/muc_manager.vala
+++ b/libdino/src/service/muc_manager.vala
@@ -28,6 +28,7 @@ public class MucManager : StreamInteractionModule, Object {
private HashMap<Account, BookmarksProvider> bookmarks_provider = new HashMap<Account, BookmarksProvider>(Account.hash_func, Account.equals_func);
private HashMap<Account, Gee.List<Jid>> invites = new HashMap<Account, Gee.List<Jid>>(Account.hash_func, Account.equals_func);
public HashMap<Account, Jid> default_muc_server = new HashMap<Account, Jid>(Account.hash_func, Account.equals_func);
+ private HashMap<Account, HashMap<Jid, string>> own_occupant_ids = new HashMap<Account, HashMap<Jid, string>>(Account.hash_func, Account.equals_func);
public static void start(StreamInteractor stream_interactor) {
MucManager m = new MucManager(stream_interactor);
@@ -386,6 +387,13 @@ public class MucManager : StreamInteractionModule, Object {
return get_own_jid(jid, account) != null;
}
+ public string? get_own_occupant_id(Account account, Jid muc_jid) {
+ if (account in own_occupant_ids && muc_jid in own_occupant_ids[account]) {
+ return own_occupant_ids[account][muc_jid];
+ }
+ return null;
+ }
+
private void on_account_added(Account account) {
stream_interactor.module_manager.get_module(account, Xep.Muc.Module.IDENTITY).self_removed_from_room.connect( (stream, jid, code) => {
left(account, jid);
@@ -413,6 +421,12 @@ public class MucManager : StreamInteractionModule, Object {
private_room_occupant_updated(account, room, occupant);
}
});
+ stream_interactor.module_manager.get_module(account, Xep.OccupantIds.Module.IDENTITY).received_own_occupant_id.connect( (stream, jid, occupant_id) => {
+ if (!(account in own_occupant_ids)) {
+ own_occupant_ids[account] = new HashMap<Jid, string>(Jid.hash_bare_func, Jid.equals_bare_func);
+ }
+ own_occupant_ids[account][jid] = occupant_id;
+ });
}
private async void search_default_muc_server(Account account) {
@@ -655,6 +669,7 @@ public class MucManager : StreamInteractionModule, Object {
if (m != null) {
// For own messages from this device (msg is a duplicate)
m.marked = Message.Marked.RECEIVED;
+ m.server_id = Xep.UniqueStableStanzaIDs.get_stanza_id(stanza, m.counterpart.bare_jid);
}
// For own messages from other devices (msg is not a duplicate msg)
message.marked = Message.Marked.RECEIVED;