diff options
author | Tarun Gupta <tarun1995gupta@gmail.com> | 2015-07-25 06:48:08 (GMT) |
---|---|---|
committer | Kevin Smith <kevin.smith@isode.com> | 2015-08-17 11:10:49 (GMT) |
commit | 2533374644704040ca67aba4e1240a9d6ea450c8 (patch) | |
tree | f8b707a2b1544f934c0bc626eab51fb737a63541 /src/com/isode/stroke/presence/SubscriptionManager.java | |
parent | 0a1f7199e26523dd2693f44a5841c5434cc9000d (diff) | |
download | stroke-2533374644704040ca67aba4e1240a9d6ea450c8.zip stroke-2533374644704040ca67aba4e1240a9d6ea450c8.tar.bz2 |
Updates Presence in accordance with Swiften.
Updates DirectedPresenceSender, PayloadAddingPresenceSender, PresenceOracle and SubscriptionManager.
License:
This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details.
Test-Information:
Tests added for: DirectedPresenceSenderTest, PayloadAddingPresenceSenderTest and PresenceOracle.
All tests pass.
Change-Id: I9ad899965f5ac32c6f21805b530c234e391be6ba
Diffstat (limited to 'src/com/isode/stroke/presence/SubscriptionManager.java')
-rw-r--r-- | src/com/isode/stroke/presence/SubscriptionManager.java | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/com/isode/stroke/presence/SubscriptionManager.java b/src/com/isode/stroke/presence/SubscriptionManager.java index 91075fc..24cfd0a 100644 --- a/src/com/isode/stroke/presence/SubscriptionManager.java +++ b/src/com/isode/stroke/presence/SubscriptionManager.java @@ -15,7 +15,15 @@ import com.isode.stroke.signals.Slot1; public class SubscriptionManager { private StanzaChannel stanzaChannel; private SignalConnection onPresenceReceivedConnection; - + + /** + * This signal is emitted when a presence subscription request is + * received. + * + * The third parameter of this signal is the original presence stanza + * received. This is useful when the subscriber adds extensions to + * the request. + */ public final Signal3<JID, String, Presence> onPresenceSubscriptionRequest = new Signal3<JID, String, Presence>(); public final Signal2<JID, String> onPresenceSubscriptionRevoked = new Signal2<JID, String>(); @@ -58,10 +66,10 @@ public class SubscriptionManager { void handleIncomingPresence(Presence presence) { JID bareJID = presence.getFrom().toBare(); - if (presence.getType() == Presence.Type.Subscribe) { + if (Presence.Type.Subscribe.equals(presence.getType())) { onPresenceSubscriptionRequest.emit(bareJID, presence.getStatus(), presence); } - else if (presence.getType() == Presence.Type.Unsubscribe) { + else if (Presence.Type.Unsubscribe.equals(presence.getType())) { onPresenceSubscriptionRevoked.emit(bareJID, presence.getStatus()); } } |