use of org.xmpp.forms.FormField in project Openfire by igniterealtime.
the class GetListActiveUsers method addStageInformation.
@Override
protected void addStageInformation(SessionData data, Element command) {
DataForm form = new DataForm(DataForm.Type.form);
form.setTitle("Requesting List of Active Users");
form.addInstruction("Fill out this form to request the active users of this service.");
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_single);
field.setLabel("Maximum number of items to show");
field.setVariable("max_items");
field.addOption("25", "25");
field.addOption("50", "50");
field.addOption("75", "75");
field.addOption("100", "100");
field.addOption("150", "150");
field.addOption("200", "200");
field.addOption("None", "none");
// Add the form to the command
command.add(form.getElement());
}
use of org.xmpp.forms.FormField in project Openfire by igniterealtime.
the class MultiUserChatServiceImpl method getExtendedInfos.
@Override
public Set<DataForm> getExtendedInfos(String name, String node, JID senderJID) {
if (name != null && node == null) {
// Answer the extended info of a given room
final MUCRoom room = getChatRoom(name);
if (room != null) {
final DataForm dataForm = new DataForm(Type.result);
final FormField fieldType = dataForm.addField();
fieldType.setVariable("FORM_TYPE");
fieldType.setType(FormField.Type.hidden);
fieldType.addValue("http://jabber.org/protocol/muc#roominfo");
final FormField fieldDescr = dataForm.addField();
fieldDescr.setVariable("muc#roominfo_description");
fieldDescr.setType(FormField.Type.text_single);
fieldDescr.setLabel(LocaleUtils.getLocalizedString("muc.extended.info.desc"));
fieldDescr.addValue(room.getDescription());
final FormField fieldSubj = dataForm.addField();
fieldSubj.setVariable("muc#roominfo_subject");
fieldSubj.setType(FormField.Type.text_single);
fieldSubj.setLabel(LocaleUtils.getLocalizedString("muc.extended.info.subject"));
fieldSubj.addValue(room.getSubject());
final FormField fieldOcc = dataForm.addField();
fieldOcc.setVariable("muc#roominfo_occupants");
fieldOcc.setType(FormField.Type.text_single);
fieldOcc.setLabel(LocaleUtils.getLocalizedString("muc.extended.info.occupants"));
fieldOcc.addValue(Integer.toString(room.getOccupantsCount()));
/*field = new XFormFieldImpl("muc#roominfo_lang");
field.setType(FormField.Type.text_single);
field.setLabel(LocaleUtils.getLocalizedString("muc.extended.info.language"));
field.addValue(room.getLanguage());
dataForm.addField(field);*/
final FormField fieldDate = dataForm.addField();
fieldDate.setVariable("x-muc#roominfo_creationdate");
fieldDate.setType(FormField.Type.text_single);
fieldDate.setLabel(LocaleUtils.getLocalizedString("muc.extended.info.creationdate"));
fieldDate.addValue(XMPPDateTimeFormat.format(room.getCreationDate()));
final Set<DataForm> dataForms = new HashSet<>();
dataForms.add(dataForm);
return dataForms;
}
}
return new HashSet<>();
}
Aggregations