Search in sources :

Example 1 with BlockContactsIQ

use of org.jivesoftware.smackx.blocking.element.BlockContactsIQ in project Smack by igniterealtime.

the class BlockContactsIQTest method checkBlockContactPushIQ.

@Test
public void checkBlockContactPushIQ() throws Exception {
    IQ iq = (IQ) PacketParserUtils.parseStanza(blockContactPushIQExample);
    BlockContactsIQ blockContactIQ = (BlockContactsIQ) iq;
    Assert.assertEquals(JidCreate.from("romeo@montague.net"), blockContactIQ.getJids().get(0));
    Assert.assertEquals(JidCreate.from("pepe@montague.net"), blockContactIQ.getJids().get(1));
}
Also used : BlockContactsIQ(org.jivesoftware.smackx.blocking.element.BlockContactsIQ) IQ(org.jivesoftware.smack.packet.IQ) BlockContactsIQ(org.jivesoftware.smackx.blocking.element.BlockContactsIQ) Test(org.junit.Test)

Example 2 with BlockContactsIQ

use of org.jivesoftware.smackx.blocking.element.BlockContactsIQ in project Smack by igniterealtime.

the class BlockingCommandManager method blockContacts.

/**
     * Block contacts.
     * 
     * @param jids
     * @throws NoResponseException
     * @throws XMPPErrorException
     * @throws NotConnectedException
     * @throws InterruptedException
     */
public void blockContacts(List<Jid> jids) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
    BlockContactsIQ blockContactIQ = new BlockContactsIQ(jids);
    connection().createStanzaCollectorAndSend(blockContactIQ).nextResultOrThrow();
}
Also used : BlockContactsIQ(org.jivesoftware.smackx.blocking.element.BlockContactsIQ)

Example 3 with BlockContactsIQ

use of org.jivesoftware.smackx.blocking.element.BlockContactsIQ in project Smack by igniterealtime.

the class BlockContactsIQTest method checkBlockContactIQStanza.

@Test
public void checkBlockContactIQStanza() throws Exception {
    List<Jid> jids = new ArrayList<>();
    jids.add(JidCreate.from("romeo@montague.net"));
    jids.add(JidCreate.from("pepe@montague.net"));
    BlockContactsIQ blockContactIQ = new BlockContactsIQ(jids);
    blockContactIQ.setStanzaId("block1");
    Assert.assertEquals(blockContactIQExample, blockContactIQ.toXML().toString());
}
Also used : Jid(org.jxmpp.jid.Jid) ArrayList(java.util.ArrayList) BlockContactsIQ(org.jivesoftware.smackx.blocking.element.BlockContactsIQ) Test(org.junit.Test)

Aggregations

BlockContactsIQ (org.jivesoftware.smackx.blocking.element.BlockContactsIQ)3 Test (org.junit.Test)2 ArrayList (java.util.ArrayList)1 IQ (org.jivesoftware.smack.packet.IQ)1 Jid (org.jxmpp.jid.Jid)1