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

View file

@ -176,7 +176,13 @@ public class FileManager : StreamInteractionModule, Object {
public bool is_sender_trustworthy(FileTransfer file_transfer, Conversation conversation) { public bool is_sender_trustworthy(FileTransfer file_transfer, Conversation conversation) {
if (file_transfer.direction == FileTransfer.DIRECTION_SENT) return true; 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; bool in_roster = stream_interactor.get_module(RosterManager.IDENTITY).get_roster_item(conversation.account, relevant_jid) != null;
return in_roster; return in_roster;
} }