Search in sources :

Example 1 with Unblock

use of com.xabber.xmpp.blocking.Unblock in project xabber-android by redsolution.

the class BlockingManager method unblockContacts.

public void unblockContacts(String account, final List<String> contacts, final UnblockContactListener listener) {
    if (!isSupported(account)) {
        return;
    }
    final Unblock unblockRequest = new Unblock();
    unblockRequest.setType(IQ.Type.set);
    for (String contact : contacts) {
        unblockRequest.addItem(contact);
    }
    sendUnblock(account, listener, unblockRequest);
}
Also used : Unblock(com.xabber.xmpp.blocking.Unblock)

Example 2 with Unblock

use of com.xabber.xmpp.blocking.Unblock in project xabber-android by redsolution.

the class BlockingManager method onPacket.

@Override
public void onPacket(ConnectionItem connection, String bareAddress, Stanza packet) {
    if (packet instanceof Block && ((Block) packet).getType() == IQ.Type.set) {
        LogManager.i(this, "Block push received");
        Block block = (Block) packet;
        for (String contact : block.getItems()) {
            blockContactLocally(packet.getTo(), contact);
        }
        requestBlockList(packet.getTo());
    }
    if (packet instanceof Unblock && ((Unblock) packet).getType() == IQ.Type.set) {
        LogManager.i(this, "Unblock push received");
        requestBlockList(packet.getTo());
    }
}
Also used : Block(com.xabber.xmpp.blocking.Block) Unblock(com.xabber.xmpp.blocking.Unblock)

Aggregations

Unblock (com.xabber.xmpp.blocking.Unblock)2 Block (com.xabber.xmpp.blocking.Block)1