Package rocks.xmpp.extensions.blocking.model

Examples of rocks.xmpp.extensions.blocking.model.Block


        xmppSession.addIQListener(new IQListener() {
            @Override
            public void handle(IQEvent e) {
                IQ iq = e.getIQ();
                if (e.isIncoming() && !e.isConsumed() && iq.getType() == IQ.Type.SET && (iq.getFrom() == null || iq.getFrom().equals(xmppSession.getConnectedResource().asBareJid()))) {
                    Block block = iq.getExtension(Block.class);
                    if (block != null) {
                        List<Jid> pushedContacts = new ArrayList<>();
                        synchronized (blockedContacts) {
                            for (Jid item : block.getItems()) {
                                blockedContacts.add(item);
                                pushedContacts.add(item);
                            }
                        }
                        xmppSession.send(iq.createResult());
View Full Code Here


     * @see <a href="http://xmpp.org/extensions/xep-0191.html#block">3.3 User Blocks Contact</a>
     */
    public void blockContact(Jid... jids) throws XmppException {
        List<Jid> items = new ArrayList<>();
        Collections.addAll(items, jids);
        xmppSession.query(new IQ(IQ.Type.SET, new Block(items)));
    }
View Full Code Here

    @Test
    public void marshalBlock() throws JAXBException, XMLStreamException {
        List<Jid> items = new ArrayList<>();
        items.add(Jid.valueOf("romeo@montague.net"));
        IQ iq = new IQ("1", IQ.Type.SET, new Block(items));
        String xml = marshal(iq);
        Assert.assertEquals(xml, "<iq id=\"1\" type=\"set\"><block xmlns=\"urn:xmpp:blocking\"><item jid=\"romeo@montague.net\"></item></block></iq>");
    }
View Full Code Here

TOP

Related Classes of rocks.xmpp.extensions.blocking.model.Block

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.