Package org.apache.vysper.xmpp.stanza

Examples of org.apache.vysper.xmpp.stanza.PresenceStanzaType


                default:
                    throw new RuntimeException("unknown mesage type " + type);
      }
    } else if (stanza instanceof PresenceStanza) {
      PresenceStanza presenceStanza = (PresenceStanza) stanza;
      PresenceStanzaType type = presenceStanza.getPresenceType();
      switch (type) {
                case SUBSCRIBE:
                case SUBSCRIBED:
                case UNSUBSCRIBE:
                case UNSUBSCRIBED:
View Full Code Here


                || (sessionContext != null && sessionContext
                        .getAttribute(SessionContext.SESSION_ATTRIBUTE_PRESENCE_STANZA_NO_RECEIVE) != null)) {
            return null;
        }

        PresenceStanzaType type = presenceStanza.getPresenceType();
        boolean available = PresenceStanzaType.isAvailable(type);

        if (isOutboundStanza) {
            Entity user = XMPPCoreStanzaHandler.extractUniqueSenderJID(presenceStanza, sessionContext);
            if (user == null) {
                return ServerErrorResponses.getStanzaError(StanzaErrorCondition.UNKNOWN_SENDER,
                        presenceStanza, StanzaErrorType.MODIFY, "sender info insufficient: no from", null, null);
            }

            if (available) {
                return handleOutboundAvailable(presenceStanza, serverRuntimeContext, sessionContext, rosterManager,
                        user, registry);
            } else if (type == UNAVAILABLE) {
                return handleOutboundUnavailable(presenceStanza, serverRuntimeContext, sessionContext, rosterManager,
                        user, registry);
            } else if (type == PROBE) {
                return handleOutboundPresenceProbe(presenceStanza, serverRuntimeContext, sessionContext, registry);
            } else if (type == ERROR) {
                throw new RuntimeException("not implemented yet");
            } else {
                throw new RuntimeException("unhandled outbound presence case " + type.value());
            }
        } else /* inbound */{
            if (available) {
                return handleInboundAvailable(presenceStanza, serverRuntimeContext, sessionContext, registry);
            } else if (type == UNAVAILABLE) {
                return handleInboundUnavailable(presenceStanza, serverRuntimeContext, sessionContext, registry);
            } else if (type == PROBE) {
                return handleInboundPresenceProbe(presenceStanza, serverRuntimeContext, sessionContext, registry,
                        rosterManager);
            } else if (type == ERROR) {
                throw new RuntimeException("not implemented yet");
            } else {
                throw new RuntimeException("unhandled inbound presence case " + type.value());
            }
        }
    }
View Full Code Here

        // if the target is present in the room, we need to send presence updates
        // otherwise we should send messages
        Occupant targetOccupant = room.findOccupantByJID(target);
       
        // notify remaining users that user got affiliation updated
        PresenceStanzaType presenceType = null;
        Status status = null;
        Role newRole;
        Entity from;
        if(targetOccupant != null) {
            newRole = targetOccupant.getRole();
View Full Code Here

                    status);

            relayStanza(target.getJid(), presenceToKicked, serverRuntimeContext);
        }

        PresenceStanzaType availType = (newRole == Role.None) ? PresenceStanzaType.UNAVAILABLE : null;

        // notify remaining users that user got role updated
        MucUserItem presenceItem = new MucUserItem(target.getAffiliation(), newRole);
        for (Occupant occupant : room.getOccupants()) {
            Stanza presenceToRemaining = MUCStanzaBuilder.createPresenceStanza(targetInRoom, occupant.getJid(),
View Full Code Here

TOP

Related Classes of org.apache.vysper.xmpp.stanza.PresenceStanzaType

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.