From e7500138a97500e155f6f7435c29874e1391b318 Mon Sep 17 00:00:00 2001 From: mesonium <93607429+mesonium@users.noreply.github.com> Date: Thu, 18 Nov 2021 23:11:29 +0100 Subject: Fix auto download if public MUC JID is in roster (#1137) Dino has downloaded files (< 5 MB) automatically from occupants in public MUCs if the public MUC JID was in the user's roster. This patch fixes it. --- libdino/src/service/file_manager.vala | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'libdino/src') diff --git a/libdino/src/service/file_manager.vala b/libdino/src/service/file_manager.vala index 19d51b44..a478695c 100644 --- a/libdino/src/service/file_manager.vala +++ b/libdino/src/service/file_manager.vala @@ -176,7 +176,13 @@ public class FileManager : StreamInteractionModule, Object { public bool is_sender_trustworthy(FileTransfer file_transfer, Conversation conversation) { if (file_transfer.direction == FileTransfer.DIRECTION_SENT) return true; - Jid relevant_jid = stream_interactor.get_module(MucManager.IDENTITY).get_real_jid(file_transfer.from, conversation.account) ?? conversation.counterpart; + + Jid relevant_jid = conversation.counterpart; + if (conversation.type_ == Conversation.Type.GROUPCHAT) { + relevant_jid = stream_interactor.get_module(MucManager.IDENTITY).get_real_jid(file_transfer.from, conversation.account); + } + if (relevant_jid == null) return false; + bool in_roster = stream_interactor.get_module(RosterManager.IDENTITY).get_roster_item(conversation.account, relevant_jid) != null; return in_roster; } -- cgit v1.2.3-70-g09d2