use of org.xmpp.forms.DataForm in project Openfire by igniterealtime.
the class AuthenticateUser method addStageInformation.
@Override
protected void addStageInformation(SessionData data, Element command) {
DataForm form = new DataForm(DataForm.Type.form);
form.setTitle("Authenticating a user");
form.addInstruction("Fill out this form to authenticate a user.");
FormField field = form.addField();
field.setType(FormField.Type.hidden);
field.setVariable("FORM_TYPE");
field.addValue("http://jabber.org/protocol/admin");
field = form.addField();
field.setType(FormField.Type.text_single);
field.setLabel("The username for this account");
field.setVariable("accountjid");
field.setRequired(true);
field = form.addField();
field.setType(FormField.Type.text_private);
field.setLabel("The password for this account");
field.setVariable("password");
field.setRequired(true);
// Add the form to the command
command.add(form.getElement());
}
use of org.xmpp.forms.DataForm in project Openfire by igniterealtime.
the class HttpBindStatus method execute.
@Override
public void execute(SessionData data, Element command) {
DataForm form = new DataForm(DataForm.Type.result);
FormField field = form.addField();
field.setType(FormField.Type.hidden);
field.setVariable("FORM_TYPE");
field.addValue("http://jabber.org/protocol/admin");
HttpBindManager manager = HttpBindManager.getInstance();
boolean isEnabled = manager.isHttpBindEnabled();
field = form.addField();
field.setLabel("Http Bind Enabled");
field.setVariable("httpbindenabled");
field.addValue(String.valueOf(isEnabled));
if (isEnabled) {
field = form.addField();
field.setLabel("Http Bind Address");
field.setVariable("httpbindaddress");
field.addValue(manager.getHttpBindUnsecureAddress());
field = form.addField();
field.setLabel("Http Bind Secure Address");
field.setVariable("httpbindsecureaddress");
field.addValue(manager.getHttpBindSecureAddress());
String jsUrl = manager.getJavaScriptUrl();
if (jsUrl != null) {
field = form.addField();
field.setLabel("Http Bind JavaScript Address");
field.setVariable("javascriptaddress");
field.addValue(jsUrl);
}
}
command.add(form.getElement());
}
use of org.xmpp.forms.DataForm in project Openfire by igniterealtime.
the class PacketsNotification method addStageInformation.
@Override
protected void addStageInformation(SessionData data, Element command) {
DataForm form = new DataForm(DataForm.Type.form);
form.setTitle("Receiving notification of packets activity");
form.addInstruction("Fill out this form to configure packets to receive.");
FormField field = form.addField();
field.setType(FormField.Type.hidden);
field.setVariable("FORM_TYPE");
field.addValue("http://jabber.org/protocol/admin");
field = form.addField();
field.setType(FormField.Type.list_multi);
field.setLabel("Type of packet");
field.setVariable("packet_type");
field.addOption("Presence", "presence");
field.addOption("IQ", "iq");
field.addOption("Message", "message");
field.setRequired(true);
field = form.addField();
field.setType(FormField.Type.list_single);
field.setLabel("Direction");
field.setVariable("direction");
field.addOption("Incoming", "incoming");
field.addOption("Outgoing", "outgoing");
field.setRequired(true);
field = form.addField();
field.setType(FormField.Type.list_single);
field.setLabel("Processing time");
field.setVariable("processed");
field.addOption("Before processing", "false");
field.addOption("After processing", "true");
field.setRequired(true);
// Add the form to the command
command.add(form.getElement());
}
use of org.xmpp.forms.DataForm in project Openfire by igniterealtime.
the class DeleteGroup method addStageInformation.
@Override
protected void addStageInformation(SessionData data, Element command) {
DataForm form = new DataForm(DataForm.Type.form);
form.setTitle("Delete group");
form.addInstruction("Fill out this form to delete a group.");
FormField field = form.addField();
field.setType(FormField.Type.hidden);
field.setVariable("FORM_TYPE");
field.addValue("http://jabber.org/protocol/admin");
field = form.addField();
field.setType(FormField.Type.text_single);
field.setLabel("Group Name");
field.setVariable("group");
field.setRequired(true);
// Add the form to the command
command.add(form.getElement());
}
use of org.xmpp.forms.DataForm in project Openfire by igniterealtime.
the class GetListGroupUsers method execute.
@Override
public void execute(SessionData data, Element command) {
Group group;
try {
group = GroupManager.getInstance().getGroup(data.getData().get("group").get(0));
} catch (GroupNotFoundException e) {
// Group not found
Element note = command.addElement("note");
note.addAttribute("type", "error");
note.setText("Group name does not exist");
return;
}
DataForm form = new DataForm(DataForm.Type.result);
form.addReportedField("jid", "User", FormField.Type.jid_single);
form.addReportedField("admin", "Description", FormField.Type.boolean_type);
// Add group members the result
for (JID memberJID : group.getMembers()) {
Map<String, Object> fields = new HashMap<>();
fields.put("jid", memberJID.toString());
fields.put("admin", false);
form.addItemFields(fields);
}
// Add group admins the result
for (JID memberJID : group.getAdmins()) {
Map<String, Object> fields = new HashMap<>();
fields.put("jid", memberJID.toString());
fields.put("admin", true);
form.addItemFields(fields);
}
command.add(form.getElement());
}
Aggregations