Package org.apache.vysper.xmpp.stanza

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


  }

  @Override
    protected Stanza executeCore(XMPPCoreStanza stanza, ServerRuntimeContext serverRuntimeContext,
                                 boolean isOutboundStanza, SessionContext sessionContext) {
        PresenceStanza presenceStanza = (PresenceStanza)stanza;

        boolean subscriptionRelated = isSubscriptionType(presenceStanza.getPresenceType());

        RosterManager rosterManager = null;
        try {
            rosterManager = (RosterManager)serverRuntimeContext.getStorageProvider(RosterManager.class);
        } catch (Exception e) {
View Full Code Here


    }

    @Override
    protected Stanza executeCore(XMPPCoreStanza coreStanza, ServerRuntimeContext serverRuntimeContext,
            boolean isOutboundStanza, SessionContext sessionContext) {
        PresenceStanza stanza = (PresenceStanza) coreStanza;

        return executePresenceLogic(stanza, serverRuntimeContext, sessionContext);
    }
View Full Code Here

                    break;
                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

            // presence probes must happen on resource level!
            relayStanza(contact, buildPresenceStanza(user, contact, UNSUBSCRIBED, null), sessionContext);
            return null;
        }

        PresenceStanza latestPresenceStanza = retrieveLatestPresence(sessionContext, user);
        if (latestPresenceStanza == null) {
            // we have no current presence info
            relayStanza(contact, buildPresenceStanza(user, contact, UNAVAILABLE, null), sessionContext);
            return null;
        }

        // return current presence as probing result
        relayStanza(contact, buildPresenceStanza(user, contact, null, latestPresenceStanza.getInnerElements()),
                sessionContext);

        return null;
    }
View Full Code Here

    protected void assertPresenceStanza(Entity expectedFrom, Entity expectedTo, PresenceStanzaType expectedType,
            String expectedShow, String expectedStatus, 
            List<MucUserItem> expectedMucItems, List<StatusCode> expectedMucStatuses,
            Stanza actualStanza) throws Exception {

        PresenceStanza actualPresenceStanza = (PresenceStanza) PresenceStanza.getWrapper(actualStanza);
       
        assertNotNull(actualStanza);
        assertEquals(expectedFrom, actualStanza.getFrom());
        assertEquals(expectedTo, actualStanza.getTo());
       
        if(expectedType != null) {
            assertEquals(expectedType.value(), actualStanza.getAttributeValue("type"));
        } else {
            assertEquals(null, actualStanza.getAttributeValue("type"));
        }
       
        assertEquals(expectedShow, actualPresenceStanza.getShow());
        assertEquals(expectedStatus, actualPresenceStanza.getStatus(null));

        XMLElement xElm = actualStanza.getSingleInnerElementsNamed("x", NamespaceURIs.XEP0045_MUC_USER);
        assertNotNull(xElm);

        Iterator<XMLElement> innerElements = xElm.getInnerElements().iterator();
View Full Code Here

TOP

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

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.