Package rocks.xmpp.extensions.oob.model.iq

Examples of rocks.xmpp.extensions.oob.model.iq.OobIQ


                "    <url>http://www.jabber.org/images/psa-license.jpg</url>\n" +
                "    <desc>A license to Jabber!</desc>\n" +
                "  </query>\n" +
                "</iq>\n";
        IQ iq = unmarshal(xml, IQ.class);
        OobIQ oobIQ = iq.getExtension(OobIQ.class);
        Assert.assertNotNull(oobIQ);
        Assert.assertEquals(oobIQ.getUrl(), new URL("http://www.jabber.org/images/psa-license.jpg"));
        Assert.assertEquals(oobIQ.getDescription(), "A license to Jabber!");
        Assert.assertEquals(oobIQ.getSessionId(), "a0");
    }
View Full Code Here


     * @throws rocks.xmpp.core.session.NoResponseException  If the recipient did not downloaded the file within the timeout.
     * @see <a href="http://xmpp.org/extensions/xep-0066.html">XEP-0066: Out of Band Data</a>
     */
    public void offerFile(URL url, String description, Jid recipient, long timeout) throws XmppException {
        try {
            xmppSession.query(new IQ(recipient, IQ.Type.SET, new OobIQ(url, description)), timeout);
        } catch (StanzaException e) {
            if (e.getStanza().getError().getCondition() instanceof NotAcceptable) {
                throw new FileTransferRejectedException();
            } else {
                throw e;
View Full Code Here

            @Override
            public void handle(IQEvent e) {
                IQ iq = e.getIQ();
                if (e.isIncoming() && isEnabled() && !e.isConsumed() && iq.getType() == IQ.Type.SET) {

                    OobIQ oobIQ = iq.getExtension(OobIQ.class);
                    if (oobIQ != null) {
                        final URL url = oobIQ.getUrl();
                        final String description = oobIQ.getDescription();
                        try {

                            HttpURLConnection connection = null;
                            try {
                                URLConnection urlConnection = url.openConnection();
View Full Code Here

TOP

Related Classes of rocks.xmpp.extensions.oob.model.iq.OobIQ

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.