quietly ignore mediated invites from blocked contacts

This commit is contained in:
Daniel Gultsch 2023-10-13 17:36:12 +02:00
parent 894ff1918c
commit 9a922ffe5d
No known key found for this signature in database
GPG key ID: F43D18AD2A0982C2

View file

@ -1097,22 +1097,26 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece
this.inviter = inviter; this.inviter = inviter;
} }
public boolean execute(Account account) { public boolean execute(final Account account) {
if (jid != null) { if (this.jid == null) {
Conversation conversation = mXmppConnectionService.findOrCreateConversation(account, jid, true, false); return false;
}
final Contact contact = this.inviter != null ? account.getRoster().getContact(this.inviter) : null;
if (contact != null && contact.isBlocked()) {
Log.d(Config.LOGTAG,account.getJid().asBareJid()+": ignore invite from "+contact.getJid()+" because contact is blocked");
return false;
}
final Conversation conversation = mXmppConnectionService.findOrCreateConversation(account, jid, true, false);
if (conversation.getMucOptions().online()) { if (conversation.getMucOptions().online()) {
Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": received invite to " + jid + " but muc is considered to be online"); Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": received invite to " + jid + " but muc is considered to be online");
mXmppConnectionService.mucSelfPingAndRejoin(conversation); mXmppConnectionService.mucSelfPingAndRejoin(conversation);
} else { } else {
conversation.getMucOptions().setPassword(password); conversation.getMucOptions().setPassword(password);
mXmppConnectionService.databaseBackend.updateConversation(conversation); mXmppConnectionService.databaseBackend.updateConversation(conversation);
final Contact contact = inviter != null ? account.getRoster().getContactFromContactList(inviter) : null; mXmppConnectionService.joinMuc(conversation, contact != null && contact.showInContactList());
mXmppConnectionService.joinMuc(conversation, contact != null && contact.mutualPresenceSubscription());
mXmppConnectionService.updateConversationUi(); mXmppConnectionService.updateConversationUi();
} }
return true; return true;
} }
return false;
}
} }
} }