Search in sources :

Example 16 with FormField

use of org.xmpp.forms.FormField in project Openfire by igniterealtime.

the class UserProperties method populateResponseFields.

private void populateResponseFields(DataForm form, List<String> accounts) {
    FormField jidField = form.addField();
    jidField.setVariable("accountjids");
    FormField emailField = form.addField();
    emailField.setVariable("email");
    FormField nameField = form.addField();
    nameField.setVariable("name");
    UserManager manager = UserManager.getInstance();
    for (String account : accounts) {
        User user;
        try {
            JID jid = new JID(account);
            user = manager.getUser(jid.getNode());
        } catch (Exception ex) {
            continue;
        }
        jidField.addValue(account);
        emailField.addValue(user.getEmail());
        nameField.addValue(user.getName());
    }
}
Also used : User(org.jivesoftware.openfire.user.User) JID(org.xmpp.packet.JID) UserManager(org.jivesoftware.openfire.user.UserManager) FormField(org.xmpp.forms.FormField)

Example 17 with FormField

use of org.xmpp.forms.FormField in project Openfire by igniterealtime.

the class GroupAdminAdded method addStageInformation.

@Override
protected void addStageInformation(SessionData data, Element command) {
    DataForm form = new DataForm(DataForm.Type.form);
    form.setTitle("Dispatching a group admin added event.");
    form.addInstruction("Fill out this form to dispatch a group admin added event.");
    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 group name of the group");
    field.setVariable("groupName");
    field.setRequired(true);
    field = form.addField();
    field.setType(FormField.Type.text_single);
    field.setLabel("The username of the new admin");
    field.setVariable("admin");
    field.setRequired(true);
    // Add the form to the command
    command.add(form.getElement());
}
Also used : DataForm(org.xmpp.forms.DataForm) FormField(org.xmpp.forms.FormField)

Example 18 with FormField

use of org.xmpp.forms.FormField in project Openfire by igniterealtime.

the class GroupAdminRemoved method addStageInformation.

@Override
protected void addStageInformation(SessionData data, Element command) {
    DataForm form = new DataForm(DataForm.Type.form);
    form.setTitle("Dispatching a group admin removed event.");
    form.addInstruction("Fill out this form to dispatch a group admin removed event.");
    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 group name of the group");
    field.setVariable("groupName");
    field.setRequired(true);
    field = form.addField();
    field.setType(FormField.Type.text_single);
    field.setLabel("The username of the admin");
    field.setVariable("admin");
    field.setRequired(true);
    // Add the form to the command
    command.add(form.getElement());
}
Also used : DataForm(org.xmpp.forms.DataForm) FormField(org.xmpp.forms.FormField)

Example 19 with FormField

use of org.xmpp.forms.FormField in project Openfire by igniterealtime.

the class GroupCreated method addStageInformation.

@Override
protected void addStageInformation(SessionData data, Element command) {
    DataForm form = new DataForm(DataForm.Type.form);
    form.setTitle("Dispatching a group created event.");
    form.addInstruction("Fill out this form to dispatch a group created event.");
    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 group name of the group that was created");
    field.setVariable("groupName");
    field.setRequired(true);
    // Add the form to the command
    command.add(form.getElement());
}
Also used : DataForm(org.xmpp.forms.DataForm) FormField(org.xmpp.forms.FormField)

Example 20 with FormField

use of org.xmpp.forms.FormField in project Openfire by igniterealtime.

the class GroupMemberRemoved method addStageInformation.

@Override
protected void addStageInformation(SessionData data, Element command) {
    DataForm form = new DataForm(DataForm.Type.form);
    form.setTitle("Dispatching a group member removed event.");
    form.addInstruction("Fill out this form to dispatch a group member removed event.");
    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 group name of the group");
    field.setVariable("groupName");
    field.setRequired(true);
    field = form.addField();
    field.setType(FormField.Type.text_single);
    field.setLabel("Member");
    field.setVariable("member");
    field.setRequired(true);
    // Add the form to the command
    command.add(form.getElement());
}
Also used : DataForm(org.xmpp.forms.DataForm) FormField(org.xmpp.forms.FormField)

Aggregations

FormField (org.xmpp.forms.FormField)76 DataForm (org.xmpp.forms.DataForm)67 Element (org.dom4j.Element)16 JID (org.xmpp.packet.JID)12 ArrayList (java.util.ArrayList)9 IQ (org.xmpp.packet.IQ)7 ClientSession (org.jivesoftware.openfire.session.ClientSession)6 Date (java.util.Date)4 List (java.util.List)4 UnauthorizedException (org.jivesoftware.openfire.auth.UnauthorizedException)3 Group (org.jivesoftware.openfire.group.Group)3 UserNotFoundException (org.jivesoftware.openfire.user.UserNotFoundException)3 ParseException (java.text.ParseException)2 HashSet (java.util.HashSet)2 Iterator (java.util.Iterator)2 CopyOnWriteArrayList (java.util.concurrent.CopyOnWriteArrayList)2 PacketException (org.jivesoftware.openfire.PacketException)2 GroupJID (org.jivesoftware.openfire.group.GroupJID)2 GroupNotFoundException (org.jivesoftware.openfire.group.GroupNotFoundException)2 MUCRoom (org.jivesoftware.openfire.muc.MUCRoom)2