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

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


                "    to='juliet@capulet.com/balcony'\n" +
                "    type='chat'>\n" +
                "  <thread>act2scene2chat1</thread>\n" +
                "  <paused xmlns='http://jabber.org/protocol/chatstates'/>\n" +
                "</message>";
        Message message = unmarshal(xml, Message.class);
        Assert.assertEquals(message.getExtensions().size(), 1);
        Assert.assertTrue(message.getExtensions().get(0) instanceof Paused);
    }
View Full Code Here


                "    to='romeo@shakespeare.lit/orchard'\n" +
                "    type='chat'>\n" +
                "  <thread>act2scene2chat1</thread>\n" +
                "  <inactive xmlns='http://jabber.org/protocol/chatstates'/>\n" +
                "</message>";
        Message message = unmarshal(xml, Message.class);
        Assert.assertEquals(message.getExtensions().size(), 1);
        Assert.assertTrue(message.getExtensions().get(0) instanceof Inactive);
    }
View Full Code Here

                "    to='romeo@shakespeare.lit/orchard'\n" +
                "    type='chat'>\n" +
                "  <thread>act2scene2chat1</thread>\n" +
                "  <gone xmlns='http://jabber.org/protocol/chatstates'/>\n" +
                "</message>";
        Message message = unmarshal(xml, Message.class);
        Assert.assertEquals(message.getExtensions().size(), 1);
        Assert.assertTrue(message.getExtensions().get(0) instanceof Gone);
    }
View Full Code Here

        xmppSession.addMessageListener(new MessageListener() {
            @Override
            public void handle(MessageEvent e) {
                if (e.isIncoming()) {
                    Message message = e.getMessage();
                    Event event = message.getExtension(Event.class);
                    if (event != null) {
                        int i = 0;
                    }
                }
            }
View Full Code Here

                "    to='kingrichard@royalty.england.lit/throne'>\n" +
                "  <body>My lord, dispatch; read o'er these articles.</body>\n" +
                "  <request xmlns='urn:xmpp:receipts'/>\n" +
                "</message>\n";

        Message message = unmarshal(xml, Message.class);
        Request request = message.getExtension(Request.class);
        Assert.assertNotNull(request);
    }
View Full Code Here

                "    id='bi29sg183b4v'\n" +
                "    to='northumberland@shakespeare.lit/westminster'>\n" +
                "  <received xmlns='urn:xmpp:receipts' id='richard2-4.1.247'/>\n" +
                "</message>\n";

        Message message = unmarshal(xml, Message.class);
        Received received = message.getExtension(Received.class);
        Assert.assertNotNull(received);
        Assert.assertEquals(received.getId(), "richard2-4.1.247");
    }
View Full Code Here

                "  <error type='cancel'>\n" +
                "    <not-acceptable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>\n" +
                "    <blocked xmlns='urn:xmpp:blocking:errors'/>\n" +
                "  </error>\n" +
                "</message>\n";
        Message message = unmarshal(xml, Message.class);
        Assert.assertTrue(message.getError().getExtension() instanceof Blocked);
    }
View Full Code Here

        xmppSession.addMessageListener(new MessageListener() {
            @Override
            public void handle(MessageEvent e) {
                if (e.isIncoming()) {
                    Message message = e.getMessage();
                    if (message.getType() == null || message.getType() == Message.Type.NORMAL) {
                        ConfirmationRequest confirmationRequest = message.getExtension(ConfirmationRequest.class);
                        if (confirmationRequest != null) {
                            notifyHttpAuthListeners(message, confirmationRequest);
                        }
                    }
                }
View Full Code Here

        if (stanza instanceof IQ) {
            // If the user wishes to confirm the request, the <iq/> response stanza MUST be of type "result"
            xmppSession.send(((IQ) stanza).createResult());
        } else if (stanza instanceof Message) {
            // If the user wishes to confirm the request, the <message/> response stanza SHOULD be of type "normal", MUST mirror the <thread/> ID (if provided by the XMPP Server), and MUST contain the original <confirm/> child element
            Message m = new Message(getRequester(), Message.Type.NORMAL);
            m.setThread(((Message) stanza).getThread());
            m.getExtensions().add(confirmationRequest);
            xmppSession.send(m);
        }
    }
View Full Code Here

        } else if (stanza instanceof Message) {
            // If the user wishes to deny the request, the <message/> response stanza MUST be of type "error",
            // MUST mirror the <thread/> ID (if provided by the XMPP Server),
            // MUST contain the original <confirm/> child element,
            // and MUST specify an error, which SHOULD be <not-authorized/>
            Message m = new Message(getRequester(), Message.Type.ERROR);
            m.setThread(((Message) stanza).getThread());
            m.getExtensions().add(confirmationRequest);
            m.setError(new StanzaError(new NotAuthorized()));
            xmppSession.send(m);
        }
    }
View Full Code Here

TOP

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

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.