You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@labs.apache.org by be...@apache.org on 2008/06/19 19:31:01 UTC
svn commit: r669583 -
/labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/core/im/handler/PresenceHandler.java
Author: berndf
Date: Thu Jun 19 10:31:01 2008
New Revision: 669583
URL: http://svn.apache.org/viewvc?rev=669583&view=rev
Log:
[vysper] prepare separating out the handler code into two: subscribe- and available-related (LABS-101)
Modified:
labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/core/im/handler/PresenceHandler.java
Modified: labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/core/im/handler/PresenceHandler.java
URL: http://svn.apache.org/viewvc/labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/core/im/handler/PresenceHandler.java?rev=669583&r1=669582&r2=669583&view=diff
==============================================================================
--- labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/core/im/handler/PresenceHandler.java (original)
+++ labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/core/im/handler/PresenceHandler.java Thu Jun 19 10:31:01 2008
@@ -56,23 +56,28 @@
protected Stanza executeCore(XMPPCoreStanza stanza,
SessionContext sessionContext) {
PresenceStanza presenceStanza = (PresenceStanza)stanza;
-
+ return executeCorePresence(sessionContext, presenceStanza);
+
+
+ }
+
+ /*package*/ Stanza executeCorePresence(SessionContext sessionContext, PresenceStanza presenceStanza) {
// TODO: either use the resource associated with the session
- // (initiatingEntity)
- // or in case of multiple resources, use the from attribute or return an
- // error if the from attribute is not present.
- Entity initiatingEntity = sessionContext.getInitiatingEntity();
- XMPPCoreStanzaVerifier verifier = presenceStanza.getCoreVerifier();
+ // (initiatingEntity)
+ // or in case of multiple resources, use the from attribute or return an
+ // error if the from attribute is not present.
+ Entity initiatingEntity = sessionContext.getInitiatingEntity();
+ XMPPCoreStanzaVerifier verifier = presenceStanza.getCoreVerifier();
ResourceRegistry registry = sessionContext.getServerRuntimeContext().getResourceRegistry();
boolean hasFrom = verifier.attributePresent("from");
boolean hasTo = verifier.attributePresent("to");
boolean hasType = verifier.attributePresent("type");
boolean isOutbound = !hasFrom && hasTo && !sessionContext.isServerToServer();
-
+
PresenceStanzaType type = presenceStanza.getPresenceType();
boolean subscriptionRelated = type != null && isSubscriptionType(type);
-
+
if (!hasTo && !hasType) {
ResourceState resourceState = registry.getResourceState(registry.getFirstResourceForSession(sessionContext));
@@ -174,8 +179,8 @@
System.err.println("unhandled presence case");
}
- return null;
- }
+ return null;
+ }
private void handleOutboundPresenceUpdate(PresenceStanza stanza, SessionContext sessionContext,
ResourceRegistry registry, Entity initiatingEntity) {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@labs.apache.org
For additional commands, e-mail: commits-help@labs.apache.org