~singpolyma/cheogram-android

2d616dd4c7c20d7b459aa05c1f4a9b016d1bf895 — Daniel Gultsch 4 months ago 5befa44
quietly ignore mediated invites from blocked contacts
1 files changed, 19 insertions(+), 15 deletions(-)

M src/main/java/eu/siacs/conversations/parser/MessageParser.java
M src/main/java/eu/siacs/conversations/parser/MessageParser.java => src/main/java/eu/siacs/conversations/parser/MessageParser.java +19 -15
@@ 1251,22 1251,26 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece
            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;
        }
    }
}