summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
authorMili Verma <mili.verma@isode.com>2012-01-19 16:31:05 (GMT)
committerKevin Smith <git@kismith.co.uk>2012-01-23 09:30:26 (GMT)
commit9c94bdc15905878d211799e0dffe29fce33e0e4f (patch)
treebd1893b0fa435b972c222ec5d44f4bb57f7dd540 /src/com
parent252dbf0022164c429e5efa32b26a6018802cea84 (diff)
downloadstroke-9c94bdc15905878d211799e0dffe29fce33e0e4f.zip
stroke-9c94bdc15905878d211799e0dffe29fce33e0e4f.tar.bz2
Update constructors of Command in line with swiften
Also fixes the call in OutgoingAdHocCommandSession which was sending null data and resulting in a crash when used in MLC. Test-information: No longer crashed MLC.
Diffstat (limited to 'src/com')
-rw-r--r--src/com/isode/stroke/adhoc/OutgoingAdHocCommandSession.java4
-rw-r--r--src/com/isode/stroke/elements/Command.java22
2 files changed, 20 insertions, 6 deletions
diff --git a/src/com/isode/stroke/adhoc/OutgoingAdHocCommandSession.java b/src/com/isode/stroke/adhoc/OutgoingAdHocCommandSession.java
index 6b1d04c..5bccb31 100644
--- a/src/com/isode/stroke/adhoc/OutgoingAdHocCommandSession.java
+++ b/src/com/isode/stroke/adhoc/OutgoingAdHocCommandSession.java
@@ -154,10 +154,8 @@ public class OutgoingAdHocCommandSession {
* Send initial request to the target.
*/
public void start() {
- Action action = null;
GenericRequest<Command> commandRequest = new GenericRequest<Command>(
- IQ.Type.Set, to_, new Command(commandNode_, "", action),
- iqRouter_);
+ IQ.Type.Set, to_, new Command(commandNode_), iqRouter_);
commandRequest.onResponse.connect(new Slot2<Command, ErrorPayload>() {
public void call(Command payload, ErrorPayload error) {
handleResponse(payload, error);
diff --git a/src/com/isode/stroke/elements/Command.java b/src/com/isode/stroke/elements/Command.java
index d82808f..91ce828 100644
--- a/src/com/isode/stroke/elements/Command.java
+++ b/src/com/isode/stroke/elements/Command.java
@@ -297,8 +297,9 @@ public class Command extends Payload {
/**
* Create an Ad-Hoc command with the given node, session ID, action and
- * {@link Status#NO_STATUS} status.
- *
+ * {@link Status#NO_STATUS} status. This can be used when submitting further
+ * actions of an ongoing Ad-Hoc session.
+ *
* @param node Node, must not be null. Each command is identified by its
* 'node' attribute. This matches its 'node' attribute from the
* service discovery.
@@ -312,8 +313,23 @@ public class Command extends Payload {
}
/**
+ * Create an Ad-Hoc command with the given node, empty session ID,
+ * {@link Action#EXECUTE} action and {@link Status#NO_STATUS} status. This
+ * can be used when initiating an Ad-Hoc command request.
+ *
+ * @param node Node, must not be null. Each command is identified by its
+ * 'node' attribute. This matches its 'node' attribute from the
+ * service discovery.
+ */
+ public Command(String node) {
+ this(node, "", Action.EXECUTE);
+ }
+
+ /**
* Create an Ad-Hoc command with an empty node, empty session ID,
- * {@link Action#EXECUTE} action and {@link Status#NO_STATUS} status.
+ * {@link Action#EXECUTE} action and {@link Status#NO_STATUS} status. This
+ * will need the attributes to be populated later as the object is not
+ * usable in this form.
*/
public Command() {
this("", "", Action.EXECUTE);