Package rocks.xmpp.core.stanza.model.client

Examples of rocks.xmpp.core.stanza.model.client.IQ


    }

    @Test
    public void unmarshalErrorIQ() throws XMLStreamException, JAXBException {
        String xml = "<iq type=\"error\"/>";
        IQ iq = unmarshal(xml, IQ.class);
        Assert.assertEquals(iq.getType(), IQ.Type.ERROR);
    }
View Full Code Here


                "  <error type='modify'>\n" +
                "    <bad-request xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>\n" +
                "    <invalid-jid xmlns='http://jabber.org/protocol/pubsub#errors'/>\n" +
                "  </error>\n" +
                "</iq>\n";
        IQ iq = unmarshal(xml, IQ.class);
        Assert.assertTrue(iq.getError().getExtension() instanceof InvalidJid);
    }
View Full Code Here

                "  <error type='auth'>\n" +
                "    <not-authorized xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>\n" +
                "    <presence-subscription-required xmlns='http://jabber.org/protocol/pubsub#errors'/>\n" +
                "  </error>\n" +
                "</iq>\n";
        IQ iq = unmarshal(xml, IQ.class);
        Assert.assertTrue(iq.getError().getExtension() instanceof PresenceSubscriptionRequired);
    }
View Full Code Here

     * @throws rocks.xmpp.core.stanza.model.StanzaException If the entity returned a stanza error.
     * @throws rocks.xmpp.core.session.NoResponseException  If the entity did not respond.
     * @see <a href="http://xmpp.org/extensions/xep-0060.html#entity-subscriptions">5.6 Retrieve Subscriptions</a>
     */
    private List<Subscription> getSubscriptions() throws XmppException {
        IQ result = xmppSession.query(new IQ(service, IQ.Type.GET, PubSub.withSubscriptions()));
        PubSub pubSub = result.getExtension(PubSub.class);
        return pubSub.getSubscriptions();
    }
View Full Code Here

                "  <error type='auth'>\n" +
                "    <not-authorized xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>\n" +
                "    <not-in-roster-group xmlns='http://jabber.org/protocol/pubsub#errors'/>\n" +
                "  </error>\n" +
                "</iq>\n";
        IQ iq = unmarshal(xml, IQ.class);
        Assert.assertTrue(iq.getError().getExtension() instanceof NotInRosterGroup);
    }
View Full Code Here

     *
     * @throws rocks.xmpp.core.stanza.model.StanzaException If the entity returned a stanza error.
     * @throws rocks.xmpp.core.session.NoResponseException  If the entity did not respond.
     */
    public void enableCarbons() throws XmppException {
        xmppSession.query(new IQ(IQ.Type.SET, new Enable()));
    }
View Full Code Here

     * @throws rocks.xmpp.core.stanza.model.StanzaException If the entity returned a stanza error.
     * @throws rocks.xmpp.core.session.NoResponseException  If the entity did not respond.
     * @see <a href="http://xmpp.org/extensions/xep-0060.html#entity-affiliations">5.7 Retrieve Affiliations</a>
     */
    private List<Affiliation> getAffiliations() throws XmppException {
        IQ result = xmppSession.query(new IQ(service, IQ.Type.GET, PubSub.withAffiliations()));
        PubSub pubSub = result.getExtension(PubSub.class);
        return pubSub.getAffiliations();
    }
View Full Code Here

     * @return The possible search fields and instructions or null, if search is not supported. Search fields are supported if they are not null.
     * @throws rocks.xmpp.core.stanza.model.StanzaException If the entity returned a stanza error.
     * @throws rocks.xmpp.core.session.NoResponseException  If the entity did not respond.
     */
    public Search discoverSearchFields(Jid service) throws XmppException {
        IQ result = xmppSession.query(new IQ(service, IQ.Type.GET, new Search()));
        return result.getExtension(Search.class);
    }
View Full Code Here

     * @return The search result (see {@link Search#getItems()}) or null if search is not supported.
     * @throws rocks.xmpp.core.stanza.model.StanzaException If the entity returned a stanza error.
     * @throws rocks.xmpp.core.session.NoResponseException  If the entity did not respond.
     */
    public Search search(Search search, Jid service) throws XmppException {
        IQ result = xmppSession.query(new IQ(service, IQ.Type.SET, search));
        return result.getExtension(Search.class);
    }
View Full Code Here

     *
     * @throws rocks.xmpp.core.stanza.model.StanzaException If the entity returned a stanza error.
     * @throws rocks.xmpp.core.session.NoResponseException  If the entity did not respond.
     */
    public void disableCarbons() throws XmppException {
        xmppSession.query(new IQ(IQ.Type.SET, new Disable()));
    }
View Full Code Here

TOP

Related Classes of rocks.xmpp.core.stanza.model.client.IQ

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.