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.
This commit is contained in:
mesonium 2021-11-18 23:11:29 +01:00 committed by GitHub
parent 8339d95621
commit e7500138a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 1 deletions

View File

@ -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;
}