GitHub - strophe/strophejs-plugin-cmds
cmd = new Strophe.Commands.RemoteCommand(conn, jid, node);
cmd.execute({
success: function(res, cmd){
proccessFields( cmd.form.fields );
doSomething();
resp = new Strophe.x.Form();
cmd.complete({ responseForm: resp });
error: myErrorFunction
}});
conn.cmds.add({node: "nodename", name: "Command description"},
function(request, result) {
var command_successful = doSomething(request);
result.attrs({status: "completed"});
if (command_successful) {
result.c('note', {type: "info"}, 'infotext');
} else {
result.c('note', {type: "info"}, 'infotext');
result.c('error', {type: 'cancel'});
result.c('forbidden', {xmlns: 'urn:ietf:params:xml:ns:xmpp-stanzas'});
}
return result;
});