Skip to content

Commit

Permalink
quietly ignore mediated invites from blocked contacts
Browse files Browse the repository at this point in the history
  • Loading branch information
iNPUTmice committed Oct 13, 2023
1 parent 894ff19 commit 9a922ff
Showing 1 changed file with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions src/main/java/eu/siacs/conversations/parser/MessageParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -1097,22 +1097,26 @@ private class Invite {
this.inviter = inviter;
}

public boolean execute(Account account) {
if (jid != null) {
Conversation conversation = mXmppConnectionService.findOrCreateConversation(account, jid, true, false);
if (conversation.getMucOptions().online()) {
Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": received invite to " + jid + " but muc is considered to be online");
mXmppConnectionService.mucSelfPingAndRejoin(conversation);
} else {
conversation.getMucOptions().setPassword(password);
mXmppConnectionService.databaseBackend.updateConversation(conversation);
final Contact contact = inviter != null ? account.getRoster().getContactFromContactList(inviter) : null;
mXmppConnectionService.joinMuc(conversation, contact != null && contact.mutualPresenceSubscription());
mXmppConnectionService.updateConversationUi();
}
return true;
public boolean execute(final Account account) {
if (this.jid == null) {
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;
}
return false;
final Conversation conversation = mXmppConnectionService.findOrCreateConversation(account, jid, true, false);
if (conversation.getMucOptions().online()) {
Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": received invite to " + jid + " but muc is considered to be online");
mXmppConnectionService.mucSelfPingAndRejoin(conversation);
} else {
conversation.getMucOptions().setPassword(password);
mXmppConnectionService.databaseBackend.updateConversation(conversation);
mXmppConnectionService.joinMuc(conversation, contact != null && contact.showInContactList());
mXmppConnectionService.updateConversationUi();
}
return true;
}
}
}

0 comments on commit 9a922ff

Please sign in to comment.