});
$('#cancelButton').bind("click", function() {
- var cancelIQ = $iq({ type: "set", to: queryJID, id: connection.getUniqueId() })
- .c("command", { xmlns: Strophe.NS.ADHOC, node: cmdNode, sessionid: sessionid, action: "cancel" });
- cmdNode = null
- sessionid = null;
- connection.sendIQ(cancelIQ, displayResult);
+ cancelCommand(displayResult);
+ });
+
+ $('#queryForm').unbind('submit');
+ $('#queryForm').bind('submit', function (event) {
+ cancelCommand(function(result) {
+ $('#queryForm').unbind('submit');
+ $('#queryForm').bind('submit', function (event) {
+ queryJID = $('#queryJID').val();
+ checkFeatures();
+ event.preventDefault();
+ });
+ });
+ queryJID = $('#queryJID').val();
+ checkFeatures();
+ event.preventDefault();
});
+
} else {
input = $("<input type='button' value='Start over'/>").bind("click", function() {
$('#output').empty();
event.preventDefault();
}
+function cancelCommand(callback) {
+ var cancelIQ = $iq({ type: "set", to: queryJID, id: connection.getUniqueId() })
+ .c("command", { xmlns: Strophe.NS.ADHOC, node: cmdNode, sessionid: sessionid, action: "cancel" });
+ cmdNode = null
+ sessionid = null;
+ connection.sendIQ(cancelIQ, callback);
+}
+
function getCommandNodes() {
var nodesIQ = $iq({ type: "get", to: queryJID, id: "nodes1" }).c("query", {xmlns: Strophe.NS.DISCO_ITEMS, node: Strophe.NS.ADHOC});
connection.sendIQ(nodesIQ, function(result) {
} else {
connection.disconnect();
}
- event.preventDefault();
+ event.preventDefault();
});
$('#queryForm').bind('submit', function (event) {
queryJID = $('#queryJID').val();
checkFeatures();
- event.preventDefault();
+ event.preventDefault();
});
});