Search in sources :

Example 1 with RemoteCommand

use of org.jivesoftware.smackx.commands.RemoteCommand in project Smack by igniterealtime.

the class ServiceAdministrationManager method addUser.

public void addUser(final EntityBareJid userJid, final String password) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
    RemoteCommand command = addUser();
    command.execute();
    Form answerForm = command.getForm().createAnswerForm();
    FormField accountJidField = answerForm.getField("accountjid");
    accountJidField.addValue(userJid.toString());
    FormField passwordField = answerForm.getField("password");
    passwordField.addValue(password);
    FormField passwordVerifyField = answerForm.getField("password-verify");
    passwordVerifyField.addValue(password);
    command.next(answerForm);
    assert (command.isCompleted());
}
Also used : Form(org.jivesoftware.smackx.xdata.Form) RemoteCommand(org.jivesoftware.smackx.commands.RemoteCommand) FormField(org.jivesoftware.smackx.xdata.FormField)

Example 2 with RemoteCommand

use of org.jivesoftware.smackx.commands.RemoteCommand in project Smack by igniterealtime.

the class ServiceAdministrationManager method deleteUser.

public void deleteUser(Set<EntityBareJid> jidsToDelete) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
    RemoteCommand command = deleteUser();
    command.execute();
    Form answerForm = command.getForm().createAnswerForm();
    FormField accountJids = answerForm.getField("accountjids");
    accountJids.addValues(JidUtil.toStringList(jidsToDelete));
    command.next(answerForm);
    assert (command.isCompleted());
}
Also used : Form(org.jivesoftware.smackx.xdata.Form) RemoteCommand(org.jivesoftware.smackx.commands.RemoteCommand) FormField(org.jivesoftware.smackx.xdata.FormField)

Aggregations

RemoteCommand (org.jivesoftware.smackx.commands.RemoteCommand)2 Form (org.jivesoftware.smackx.xdata.Form)2 FormField (org.jivesoftware.smackx.xdata.FormField)2