From c8b20d0f5f33fb8b9898d216c3b4c9280abf31da Mon Sep 17 00:00:00 2001 From: fiaxh Date: Sun, 26 May 2024 18:24:54 +0200 Subject: Store requested disco results with computed hash, use for offline determining of private MUCs --- libdino/src/service/muc_manager.vala | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'libdino/src/service/muc_manager.vala') diff --git a/libdino/src/service/muc_manager.vala b/libdino/src/service/muc_manager.vala index 119079f0..6b52fe36 100644 --- a/libdino/src/service/muc_manager.vala +++ b/libdino/src/service/muc_manager.vala @@ -232,15 +232,8 @@ public class MucManager : StreamInteractionModule, Object { //the term `private room` is a short hand for members-only+non-anonymous rooms public bool is_private_room(Account account, Jid jid) { - XmppStream? stream = stream_interactor.get_stream(account); - if (stream == null) { - return false; - } - Xep.Muc.Flag? flag = stream.get_flag(Xep.Muc.Flag.IDENTITY); - if (flag == null) { - return false; - } - return flag.has_room_feature(jid, Xep.Muc.Feature.NON_ANONYMOUS) && flag.has_room_feature(jid, Xep.Muc.Feature.MEMBERS_ONLY); + var entity_info = stream_interactor.get_module(EntityInfo.IDENTITY); + return entity_info.has_feature_offline(account, jid, "muc_membersonly") && entity_info.has_feature_offline(account, jid, "muc_nonanonymous"); } public bool is_moderated_room(Account account, Jid jid) { -- cgit v1.2.3-70-g09d2 From da4ded964f122ffef194d3f7d7cf7fd0fd71d8cf Mon Sep 17 00:00:00 2001 From: Matthew Fennell Date: Fri, 28 Jun 2024 15:33:59 +0100 Subject: Self-ping with server-given roomnick (#1594) * Self-ping with server-given roomnick (#1467) XEP-0045 describes how a server can modify a user's roomnick when joining a room. To do this, it assigns status code 210, and sets the "from" attribute to a JID with thew newly assigned nickname when sending the user's presence back to the client. This is used in IRC gateways such as biboumi. Since you can only have one nick per IRC server, if you try and join multiple IRC-bridged MUCs on the same IRC server, it will modify your nick to match the existing one you have on that server. Currently, when Dino performs a self-ping after joining a room, it uses the nick that the client first requested, instead of the nick returned from the server. This can lead to incorrect self-pings being sent out (until the client is restarted, and populates mucs_todo correctly). This happens because it adds the requested Jid to mucs_todo, before getting the given nick from the server. Therefore, this commit adds the jid that has been given from the server instead. If there is any error in requesting to join the MUC, it adds the requested nick, to match existing behaviour and allow the request to be retried via future self-pings. fixes #1467 * Minor coding style changes --------- Co-authored-by: fiaxh --- libdino/src/service/muc_manager.vala | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'libdino/src/service/muc_manager.vala') diff --git a/libdino/src/service/muc_manager.vala b/libdino/src/service/muc_manager.vala index 6b52fe36..111ace22 100644 --- a/libdino/src/service/muc_manager.vala +++ b/libdino/src/service/muc_manager.vala @@ -84,11 +84,6 @@ public class MucManager : StreamInteractionModule, Object { } mucs_joining[account].add(jid); - if (!mucs_todo.has_key(account)) { - mucs_todo[account] = new HashSet(Jid.hash_bare_func, Jid.equals_bare_func); - } - mucs_todo[account].add(jid.with_resource(nick_)); - Muc.JoinResult? res = yield stream.get_module(Xep.Muc.Module.IDENTITY).enter(stream, jid.bare_jid, nick_, password, history_since, receive_history, null); mucs_joining[account].remove(jid); @@ -127,6 +122,11 @@ public class MucManager : StreamInteractionModule, Object { enter_errors[jid] = res.muc_error; } + if (!mucs_todo.has_key(account)) { + mucs_todo[account] = new HashSet(Jid.hash_bare_func, Jid.equals_bare_func); + } + mucs_todo[account].add(jid.with_resource(res.nick ?? nick_)); + return res; } -- cgit v1.2.3-70-g09d2