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

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


                "    <item affiliation='member' role='participant'/>\n" +
                "    <status code='110'/>\n" +
                "    <status code='210'/>\n" +
                "  </x>\n" +
                "</presence>\n";
        Presence presence = unmarshal(xml, Presence.class);
        MucUser mucUser = presence.getExtension(MucUser.class);
        Assert.assertNotNull(mucUser);
        Assert.assertNotNull(mucUser.getItem());
        Assert.assertEquals(mucUser.getStatusCodes().size(), 2);
        Assert.assertEquals(mucUser.getStatusCodes().get(0).getCode(), 110);
        Assert.assertEquals(mucUser.getStatusCodes().get(1).getCode(), 210);
View Full Code Here


        xmppSession.query(new IQ(IQ.Type.SET, vCard));

        // Then inform about the update by sending a presence. The avatar manager will add the update extension.
        AvatarManager avatarManager = xmppSession.getExtensionManager(AvatarManager.class);
        if (isEnabled() && avatarManager.isEnabled()) {
            Presence presence = xmppSession.getPresenceManager().getLastSentPresence();
            if (presence == null) {
                presence = new Presence();
            }
            presence.getExtensions().clear();
            xmppSession.send(presence);
        }
    }
View Full Code Here

                "          jid='hag66@shakespeare.lit/pda'\n" +
                "          nick='oldhag'\n" +
                "          role='participant'/>\n" +
                "  </x>\n" +
                "</presence>\n";
        Presence presence = unmarshal(xml, Presence.class);
        MucUser mucUser = presence.getExtension(MucUser.class);
        Assert.assertNotNull(mucUser);
        Assert.assertNotNull(mucUser.getItem());
        Assert.assertEquals(mucUser.getItem().getJid(), Jid.valueOf("hag66@shakespeare.lit/pda"));
        Assert.assertEquals(mucUser.getItem().getNick(), "oldhag");
    }
View Full Code Here

                "      <reason>Avaunt, you cullion!</reason>\n" +
                "    </item>\n" +
                "    <status code='307'/>\n" +
                "  </x>\n" +
                "</presence>";
        Presence presence = unmarshal(xml, Presence.class);
        MucUser mucUser = presence.getExtension(MucUser.class);
        Assert.assertNotNull(mucUser);
        Assert.assertNotNull(mucUser.getItem());
        Assert.assertNotNull(mucUser.getItem().getActor());
        Assert.assertEquals(mucUser.getItem().getActor().getNick(), "Fluellen");
    }
View Full Code Here

                "    <destroy jid='coven@chat.shakespeare.lit'>\n" +
                "      <reason>Macbeth doth come.</reason>\n" +
                "    </destroy>\n" +
                "  </x>\n" +
                "</presence>\n";
        Presence presence = unmarshal(xml, Presence.class);
        MucUser mucUser = presence.getExtension(MucUser.class);
        Assert.assertNotNull(mucUser);
        Assert.assertNotNull(mucUser.getDestroy());
        Assert.assertEquals(mucUser.getDestroy().getJid(), Jid.valueOf("coven@chat.shakespeare.lit"));
        Assert.assertEquals(mucUser.getDestroy().getReason(), "Macbeth doth come.");
    }
View Full Code Here

                }
                ContactExchange.Item rosterItem = new ContactExchange.Item(contact.getJid(), contact.getName(), contact.getGroups(), ContactExchange.Item.Action.ADD);
                contactExchange.getItems().add(rosterItem);
            }
            // http://xmpp.org/extensions/xep-0144.html#stanza
            Presence presence = xmppSession.getPresenceManager().getPresence(jid);
            if (presence.isAvailable()) {
                xmppSession.query(new IQ(presence.getFrom(), IQ.Type.SET, contactExchange));
            } else {
                // If the sending entity does not know that the receiving entity is online and available, it MUST send a <message/> stanza to the receiving entity's "bare JID" (user@host) rather than an <iq/> stanza to a particular resource.
                Message message = new Message(jid, Message.Type.NORMAL);
                message.getExtensions().add(contactExchange);
                xmppSession.send(message);
View Full Code Here

                    // Connect
                    xmppSession.connect();
                    // Login
                    xmppSession.login("admin", "admin", "xmpp");
                    // Send initial presence
                    xmppSession.send(new Presence());
                } catch (IOException | LoginException | NoSuchAlgorithmException | KeyManagementException e) {
                    e.printStackTrace();
                }
            }
        });
View Full Code Here

                    // Connect
                    xmppSession.connect();
                    // Login
                    xmppSession.login("222", "222", "muc");
                    // Send initial presence
                    xmppSession.send(new Presence());

                    MultiUserChatManager multiUserChatManager = xmppSession.getExtensionManager(MultiUserChatManager.class);
                    ChatService chatService = multiUserChatManager.createChatService(Jid.valueOf("conference." + xmppSession.getDomain()));
                    ChatRoom chatRoom = chatService.createRoom("test");
                    chatRoom.addOccupantListener(new OccupantListener() {
View Full Code Here

//                            System.out.println(e.getPublisher() + " updated his location: " + e.getGeoLocation());
//                        }
//                    });

                    // Send initial presence
                    xmppSession.send(new Presence());

                } catch (IOException | LoginException e) {
                    e.printStackTrace();
                }
            }
View Full Code Here

                    // Connect
                    xmppSession.connect();
                    // Login
                    xmppSession.login("111", "111", "muc");
                    // Send initial presence
                    xmppSession.send(new Presence());

                    MultiUserChatManager multiUserChatManager = xmppSession.getExtensionManager(MultiUserChatManager.class);
                    ChatService chatService = multiUserChatManager.createChatService(Jid.valueOf("conference." + xmppSession.getDomain()));
                    ChatRoom chatRoom = chatService.createRoom("test");
                    chatRoom.addOccupantListener(new OccupantListener() {
View Full Code Here

TOP

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

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.