Package rocks.xmpp.core

Examples of rocks.xmpp.core.Jid


    }

    private boolean checkStanzaForReachabilityAndNotify(Stanza stanza) {
        Reachability reachability = stanza.getExtension(Reachability.class);
        if (stanza.getFrom() != null) {
            Jid contact = stanza.getFrom().asBareJid();
            if (reachability != null) {
                synchronized (reachabilities) {
                    List<Address> oldReachabilityAddresses = reachabilities.get(contact);
                    if (oldReachabilityAddresses == null || !oldReachabilityAddresses.equals(reachability.getAddresses())) {
                        reachabilities.put(contact, reachability.getAddresses());
View Full Code Here


            enterPresence.getExtensions().add(new Muc(password, history));
            this.nick = nick;
            xmppSession.sendAndAwaitPresence(enterPresence, new StanzaFilter<Presence>() {
                @Override
                public boolean accept(Presence presence) {
                    Jid room = presence.getFrom().asBareJid();
                    return room.equals(roomJid) && isSelfPresence(presence);
                }
            });
        } catch (XmppException e) {
            xmppSession.removeMessageListener(messageListener);
            xmppSession.removePresenceListener(presenceListener);
View Full Code Here

    @Test
    public void marshalPresenceMultipleStatus() throws JAXBException, XMLStreamException {
        Presence presence = new Presence(Presence.Type.SUBSCRIBE);
        presence.setId("id");
        presence.setTo(new Jid("to", "domain"));
        presence.setFrom(new Jid("from", "domain"));
        presence.getStatuses().add(new Presence.Status("status", "de"));
        Presence.Status status = new Presence.Status("status2");
        status.setLanguage("en");
        presence.getStatuses().add(status);
        String xml = marshal(presence);
View Full Code Here

    @Test
    public void marshalPresenceShowDnd() throws JAXBException, XMLStreamException {
        Presence presence = new Presence(Presence.Type.SUBSCRIBED);
        presence.setId("id");
        presence.setTo(new Jid("to", "domain"));
        presence.setFrom(new Jid("from", "domain"));
        presence.setShow(Presence.Show.DND);
        String xml = marshal(presence);
        Assert.assertEquals(xml, "<presence from=\"from@domain\" id=\"id\" to=\"to@domain\" type=\"subscribed\"><show>dnd</show></presence>");
    }
View Full Code Here

    @Test
    public void marshalPresenceShowAway() throws JAXBException, XMLStreamException {
        Presence presence = new Presence(Presence.Type.UNSUBSCRIBE);
        presence.setId("id");
        presence.setTo(new Jid("to", "domain"));
        presence.setFrom(new Jid("from", "domain"));
        presence.setShow(Presence.Show.AWAY);
        String xml = marshal(presence);
        Assert.assertEquals(xml, "<presence from=\"from@domain\" id=\"id\" to=\"to@domain\" type=\"unsubscribe\"><show>away</show></presence>");
    }
View Full Code Here

    @Test
    public void marshalPresenceShowXA() throws JAXBException, XMLStreamException {
        Presence presence = new Presence(Presence.Type.UNSUBSCRIBED);
        presence.setId("id");
        presence.setTo(new Jid("to", "domain"));
        presence.setFrom(new Jid("from", "domain"));
        presence.setShow(Presence.Show.XA);
        String xml = marshal(presence);
        Assert.assertEquals(xml, "<presence from=\"from@domain\" id=\"id\" to=\"to@domain\" type=\"unsubscribed\"><show>xa</show></presence>");
    }
View Full Code Here

    @Test
    public void marshalPresenceShowChat() throws JAXBException, XMLStreamException {
        Presence presence = new Presence(Presence.Type.UNAVAILABLE);
        presence.setId("id");
        presence.setTo(new Jid("to", "domain"));
        presence.setFrom(new Jid("from", "domain"));
        presence.setShow(Presence.Show.CHAT);
        String xml = marshal(presence);
        Assert.assertEquals(xml, "<presence from=\"from@domain\" id=\"id\" to=\"to@domain\" type=\"unavailable\"><show>chat</show></presence>");
    }
View Full Code Here

                                }
                            }
                        }

                        if (avatarUpdate != null && avatarUpdate.getHash() != null) {
                            final Jid contact;
                            MucUser mucUser = presence.getExtension(MucUser.class);
                            if (mucUser != null) {
                                if (mucUser.getItem() != null && mucUser.getItem().getJid() != null) {
                                    contact = mucUser.getItem().getJid().asBareJid();
                                } else {
View Full Code Here

TOP

Related Classes of rocks.xmpp.core.Jid

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.