summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTarun Gupta <tarun1995gupta@gmail.com>2015-07-15 23:49:56 (GMT)
committerNick Hudson <nick.hudson@isode.com>2015-07-28 15:42:52 (GMT)
commit251813ccca9404d8d4122b2848f9fec86a451bf5 (patch)
treea1ebb0f6a04547ef6b588ea85c1a50ea5d8e4997 /src/com/isode/stroke/adhoc
parent673655830b0325d964e67fa835ea83f485e9beeb (diff)
downloadstroke-251813ccca9404d8d4122b2848f9fec86a451bf5.zip
stroke-251813ccca9404d8d4122b2848f9fec86a451bf5.tar.bz2
Completes Components and AdHoc.
Adds Component, ComponentConnector, ComponentError, ComponentSession, ComponentXMLTracer, CoreComponent, ComponentSessionStanzaChannel, ComponentXMTracer, CoreComponent. Updates CoreClient, StrokeGUI, BasicSessionStream and SessionStream and Client, so that signal definition can be changed. Updates ComponentHandshake element, Entity. Updates OutgoingAdHocCommandSession to have feature parity with Swiften. This patch does not port Client or Session fully, which will be done in separate future patches. License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details. Test-Information: Test added for ComponentSession, which passes. Test for ComponentConnector cannot be ported right now and will be done in future patches, as it requires some bits of Network to be ported. Change-Id: I7138a2041fe28a2be7ac57cb47b15365f9334b24
Diffstat (limited to 'src/com/isode/stroke/adhoc')
-rw-r--r--src/com/isode/stroke/adhoc/OutgoingAdHocCommandSession.java14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/com/isode/stroke/adhoc/OutgoingAdHocCommandSession.java b/src/com/isode/stroke/adhoc/OutgoingAdHocCommandSession.java
index 5bccb31..4369f8e 100644
--- a/src/com/isode/stroke/adhoc/OutgoingAdHocCommandSession.java
+++ b/src/com/isode/stroke/adhoc/OutgoingAdHocCommandSession.java
@@ -23,6 +23,7 @@ import com.isode.stroke.queries.GenericRequest;
import com.isode.stroke.queries.IQRouter;
import com.isode.stroke.signals.Signal1;
import com.isode.stroke.signals.Slot2;
+import com.isode.stroke.signals.SignalConnection;
/**
* This class maintains the session between the client and the server for an
@@ -71,6 +72,7 @@ public class OutgoingAdHocCommandSession {
private boolean isMultiStage_;
private String sessionID_;
private HashMap<Action, ActionState> actionStates_ = new HashMap<Action, ActionState>();
+ private SignalConnection connection_;
/**
* Create an Ad-Hoc command session. The initial command will be sent to the
@@ -101,6 +103,13 @@ public class OutgoingAdHocCommandSession {
isMultiStage_ = false;
}
+ /**
+ * This method needs to be called for the object to be eligible for garbage collection.
+ */
+ public void delete() {
+ connection_.disconnect();
+ }
+
private void handleResponse(Command payload, ErrorPayload error) {
if (error != null) {
onError.emit(error);
@@ -156,7 +165,7 @@ public class OutgoingAdHocCommandSession {
public void start() {
GenericRequest<Command> commandRequest = new GenericRequest<Command>(
IQ.Type.Set, to_, new Command(commandNode_), iqRouter_);
- commandRequest.onResponse.connect(new Slot2<Command, ErrorPayload>() {
+ connection_ = commandRequest.onResponse.connect(new Slot2<Command, ErrorPayload>() {
public void call(Command payload, ErrorPayload error) {
handleResponse(payload, error);
}
@@ -206,7 +215,8 @@ public class OutgoingAdHocCommandSession {
GenericRequest<Command> commandRequest = new GenericRequest<Command>(
IQ.Type.Set, to_, command, iqRouter_);
- commandRequest.onResponse.connect(new Slot2<Command, ErrorPayload>() {
+ connection_.disconnect();
+ connection_ = commandRequest.onResponse.connect(new Slot2<Command, ErrorPayload>() {
public void call(Command payload, ErrorPayload error) {
handleResponse(payload, error);
}