Package org.xmpp.packet

Examples of org.xmpp.packet.Presence.addChildElement()


    presence.setShow(Presence.Show.away);
    String servername = host.name.replaceAll("\\^\\d", "");
    presence.setStatus("Playing on server " + servername + " with "
        + host.nrofracers + " other racers. (Servername with colors: "
        + host.name + ")");
    Element x = presence.addChildElement("x",
        "http://goim.sphene.net/gameStatus");
    x.addAttribute("game", "lfss2");
    x.addAttribute("target", "127.0.0.1:100"); // We need to add a dummy
                          // target.
    x.addAttribute("servername", host.name);
View Full Code Here


            presence.setType(Presence.Type.unavailable);
            presence.setStatus(null);
            // Change (or add) presence information about roles and affiliations
            Element childElement = presence.getChildElement("x", "http://jabber.org/protocol/muc#user");
            if (childElement == null) {
                childElement = presence.addChildElement("x", "http://jabber.org/protocol/muc#user");
            }
            Element item = childElement.element("item");
            if (item == null) {
                item = childElement.addElement("item");
            }
View Full Code Here

                // Send a presence stanza of type "unavailable" to the occupant
                Presence presence = createPresence(Presence.Type.unavailable);
                presence.setFrom(removedRole.getRoleAddress());

                // A fragment containing the x-extension for room destruction.
                Element fragment = presence.addChildElement("x",
                        "http://jabber.org/protocol/muc#user");
                Element item = fragment.addElement("item");
                item.addAttribute("affiliation", "none");
                item.addAttribute("role", "none");
                if (alternateJID != null && alternateJID.length() > 0) {
View Full Code Here

                                buf.append(p.toXML());
                            }
                        }
                        else {
                            Presence storedPresence = (Presence)p;
                            Element delay = storedPresence.addChildElement("x", "jabber:x:delay");
                            delay.addAttribute("stamp", UTC_FORMAT.format(date));
                            buf.append(p.toXML());
                        }
                        // Append an XML representation of the packet to the string buffer
                    }
View Full Code Here

                                buf.append(p.toXML());
                            }
                        }
                        else {
                            Presence storedPresence = (Presence)p;
                            Element delay = storedPresence.addChildElement("x", "jabber:x:delay");
                            delay.addAttribute("stamp", UTC_FORMAT.format(date));
                            buf.append(p.toXML());
                        }
                        // Append an XML representation of the packet to the string buffer
                    }
View Full Code Here

        Presence.Type type;
        if (workgroup.isAvailable()) {
            type = null;
            // Add the a child element that will contain information about the workgroup
            Element child = presence.addChildElement("workgroup",
                    "http://jivesoftware.com/protocol/workgroup");
            // Add the last modification date of the workgroup
            child.addElement("lastModified").setText(UTC_FORMAT.format(workgroup.getModificationDate()));
        }
        else {
View Full Code Here

            child.addElement("lastModified").setText(UTC_FORMAT.format(workgroup.getModificationDate()));
        }
        else {
            type = Presence.Type.unavailable;
            // Add the a child element that will contain information about the workgroup
            Element child = presence.addChildElement("workgroup",
                    "http://jivesoftware.com/protocol/workgroup");
            // Add the last modification date of the workgroup
            child.addElement("lastModified").setText(UTC_FORMAT.format(workgroup.getModificationDate()));
        }
        presence.setType(type);
View Full Code Here

                    // has occurred.
                    String reason = "Your account signed into this chatroom with the same nickname from another location.";
                    Presence updatedPresence = new Presence(Presence.Type.unavailable);
                    updatedPresence.setFrom(occupants.get(nickname.toLowerCase()).getRoleAddress());
                    updatedPresence.setTo(occupants.get(nickname.toLowerCase()).getUserAddress());
                    Element frag = updatedPresence.addChildElement(
                            "x", "http://jabber.org/protocol/muc#user");

                    // Set the person who performed the kick ("you" effectively)
                    frag.addElement("item").addElement("actor").setText(user.getAddress().toString());
                    // Add the reason why the user was kicked
View Full Code Here

    public Presence getStatusPresence() {
        Presence queueStatus = new Presence();
        queueStatus.setFrom(address);

        // Add Notify Queue
        Element status = queueStatus.addChildElement("notify-queue", "http://jabber.org/protocol/workgroup");

        Element countElement = status.addElement("count");
        countElement.setText(Integer.toString(getRequestCount()));
        if (getRequestCount() > 0) {
            Element oldestElement = status.addElement("oldest");
View Full Code Here

        }
        else {
            queueStatus.setType(Presence.Type.unavailable);
        }

        Element details = queueStatus.addChildElement("notify-queue-details", "http://jabber.org/protocol/workgroup");
        int i = 0;
        for (UserRequest request : getRequests()) {
            Element user = details.addElement("user", "http://jabber.org/protocol/workgroup");
            try {
                user.addAttribute("jid", request.getUserJID().toString());
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.