Package org.xmpp.packet

Examples of org.xmpp.packet.Presence


    @Override
  public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
        super.readExternal(in);
        Element packetElement = (Element) ExternalizableUtil.getInstance().readSerializable(in);
        presence = new Presence(packetElement, true);
        nickname = ExternalizableUtil.getInstance().readSafeUTF(in);
        role = ExternalizableUtil.getInstance().readInt(in);
        affiliation = ExternalizableUtil.getInstance().readInt(in);
    }
View Full Code Here


                    } else {
                      routes.add(from);
                    }
                 
                  for (JID route : routes) {
                      Presence reply = new Presence();
                      reply.setID(packet.getID());
                      reply.setTo(route);
                      reply.setFrom(to);
                      reply.setError(PacketError.Condition.remote_server_not_found);
                      routingTable.routePacket(reply.getTo(), reply, true);
                  }
                }
                else if (packet instanceof Message) {
                    Message reply = new Message();
                    reply.setID(packet.getID());
                    reply.setTo(from);
                    reply.setFrom(to);
                    reply.setType(((Message)packet).getType());
                    reply.setThread(((Message)packet).getThread());
                    reply.setError(PacketError.Condition.remote_server_not_found);
                    routingTable.routePacket(reply.getTo(), reply, true);
                }
            }
            catch (Exception e) {
                Log.warn("Error returning error to sender. Original packet: " + packet, e);
            }
View Full Code Here

            if (type.equals(DISABLED)) {
                return;
            }

            if ((packet instanceof Presence) && !incoming && !processed) {
                Presence presencePacket = (Presence) packet;

                Type presenceType = presencePacket.getType();
                if (presenceType != null && presenceType.equals(Presence.Type.subscribe)) {
                    JID toJID = presencePacket.getTo();
                    JID fromJID = presencePacket.getFrom();

                    String toNode = toJID.getNode();
                    if (whiteList.contains(toNode)) {
                        return;
                    }
View Full Code Here

                    return;
                }
            }

            // Simulate that the target user has accepted the presence subscription request
            Presence presence = new Presence();
            presence.setType(Presence.Type.subscribed);

            presence.setTo(fromJID);
            presence.setFrom(toJID);
            router.route(presence);

            throw new PacketRejectedException();
        }
View Full Code Here

                    return;
                }
            }

            // Simulate that the target user has rejected the presence subscription request
            Presence presence = new Presence();
            presence.setType(Presence.Type.unsubscribed);

            // This is to get around an issue in Spark
            // (http://www.igniterealtime.org/issues/browse/SPARK-300).
            // Unfortunately, this is a bit of a hack and can easily be defeated
            // if a user changes their resource when using Spark.
            if (JiveGlobals.getBooleanProperty("plugin.subscription.sparkCheck", false)) {
                String resource = fromJID.getResource();
                if (resource != null && resource.equalsIgnoreCase("Spark")) {
                    presence.setType(Presence.Type.unsubscribed);
                }
            }

            presence.setTo(fromJID);
            presence.setFrom(toJID);
            router.route(presence);

            throw new PacketRejectedException();
        }
View Full Code Here

    @Override
  public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
        super.readExternal(in);
        Element packetElement = (Element) ExternalizableUtil.getInstance().readSerializable(in);
        presence = new Presence(packetElement, true);
        role = ExternalizableUtil.getInstance().readInt(in);
        affiliation = ExternalizableUtil.getInstance().readInt(in);
        voiceOnly = ExternalizableUtil.getInstance().readBoolean(in);
        roleAddress = (JID) ExternalizableUtil.getInstance().readSerializable(in);
        userAddress = (JID) ExternalizableUtil.getInstance().readSerializable(in);
View Full Code Here

    private void checkPresences() {
        for (JID prober : presenceMap.keySet()) {
            JID probee = presenceMap.get(prober);

            if (routingTable.hasComponentRoute(probee)) {
                Presence presence = new Presence();
                presence.setFrom(prober);
                presence.setTo(probee);
                routingTable.routePacket(probee, presence, false);

                // No reason to hold onto prober reference.
                presenceMap.remove(prober);
            }
View Full Code Here

        ExternalizableUtil.getInstance().writeBoolean(out, offlineFloodStopped);
    }

    public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
        Element packetElement = (Element) ExternalizableUtil.getInstance().readSerializable(in);
        presence = new Presence(packetElement, true);
        if (ExternalizableUtil.getInstance().readBoolean(in)) {
            defaultList = ExternalizableUtil.getInstance().readSafeUTF(in);
        }
        if (ExternalizableUtil.getInstance().readBoolean(in)) {
            activeList = ExternalizableUtil.getInstance().readSafeUTF(in);
View Full Code Here

     *
     * @return true if the workgroup is available to take requests.
     */
    public boolean isAvailable() {
        for (RequestQueue requestQueue : getRequestQueues()) {
            Presence presence = requestQueue.getDetailedStatusPresence();
            if (presence.getType() == null) {
                return true;
            }
        }
        return false;
    }
View Full Code Here

            reply.setFrom(packet.getTo());
            reply.setError(PacketError.Condition.not_allowed);
            send(reply);
        }
        else if (packet instanceof Presence) {
            Presence reply = new Presence();
            reply.setID(packet.getID());
            reply.setTo(packet.getFrom());
            reply.setFrom(packet.getTo());
            reply.setError(PacketError.Condition.not_allowed);
            send(reply);
        }
        // Check if a message notifying the rejection should be sent
        if (e.getRejectionMessage() != null && e.getRejectionMessage().trim().length() > 0) {
            // A message for the rejection will be sent to the sender of the rejected packet
View Full Code Here

TOP

Related Classes of org.xmpp.packet.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.