Package org.jivesoftware.smackx

Examples of org.jivesoftware.smackx.Form


        try {
            // Create the room
            muc.create("testbot1");

            // Get the the room's configuration form
            Form form = muc.getConfigurationForm();
            assertNotNull("No room configuration form", form);
            // Create a new form to submit based on the original form
            Form submitForm = form.createAnswerForm();
            // Add default answers to the form to submit
            for (Iterator<FormField> fields = form.getFields(); fields.hasNext();) {
                FormField field = fields.next();
                if (!FormField.TYPE_HIDDEN.equals(field.getType())
                    && field.getVariable() != null) {
                    // Sets the default value as the answer
                    submitForm.setDefaultAnswer(field.getVariable());
                }
            }
            List<String> owners = new ArrayList<String>();
            owners.add(getBareJID(0));
            submitForm.setAnswer("muc#roomconfig_roomowners", owners);

            // Update the new room's configuration
            muc.sendConfigurationForm(submitForm);

            // Destroy the new room
View Full Code Here


            // Create the room
            muc.create("testbot");

            // Send an empty room configuration form which indicates that we want
            // an instant room
            muc.sendConfigurationForm(new Form(Form.TYPE_SUBMIT));

            // Destroy the new room
            muc.destroy("The room has almost no activity...", null);
        }
        catch (XMPPException e) {
View Full Code Here

      final MultiUserChat muc = new MultiUserChat(ecfConnection.getXMPPConnection(), roomID);

      if (!checkRoom(conference, roomID)) {
        // otherwise create a new one
        muc.create(nickname);
        muc.sendConfigurationForm(new Form(Form.TYPE_SUBMIT));
        final String subject = (properties == null) ? null : (String) properties.get(PROP_XMPP_SUBJECT);
        if (subject != null)
          muc.changeSubject(subject);
      }
View Full Code Here

        // the partial result is added to the result list
        while (criterionsIterator.hasNext()) {
          ICriterion criterion = (ICriterion) criterionsIterator
              .next();
          if (criterion.equals(fields[i])) {
            Form answerForm = form.createAnswerForm();
            answerForm.setAnswer(fields[i], true);
            answerForm.setAnswer(SEARCH_ACTION, criterion
                .toExpression());
            ReportedData data = manager.sendSearchForm(
                ecfConnection.getXMPPConnection(), answerForm,
                SERVICE_SEARCH
                    + ecfConnection.getXMPPConnection()
View Full Code Here

        if (inQueue) {
            throw new IllegalStateException("Already in queue " + workgroupJID);
        }

        // Build dataform from metadata
        Form form = new Form(Form.TYPE_SUBMIT);
        Iterator<String> iter = metadata.keySet().iterator();
        while (iter.hasNext()) {
            String name = iter.next();
            String value = metadata.get(name).toString();

            String escapedName = StringUtils.escapeForXML(name);
            String escapedValue = StringUtils.escapeForXML(value);

            FormField field = new FormField(escapedName);
            field.setType(FormField.TYPE_TEXT_SINGLE);
            form.addField(field);
            form.setAnswer(escapedName, escapedValue);
        }
        joinQueue(form, userID);
    }
View Full Code Here

    public Form getForm() {
        if (data.getForm() == null) {
            return null;
        }
        else {
            return new Form(data.getForm());
        }
    }
View Full Code Here

                    // Set the new data to the command.
                    command.setData(response);

                    if (Action.next.equals(action)) {
                        command.incrementStage();
                        command.next(new Form(requestData.getForm()));
                        if (command.isLastStage()) {
                            // If it is the last stage then the command is
                            // completed
                            response.setStatus(Status.completed);
                        }
                        else {
                            // Otherwise it is still executing
                            response.setStatus(Status.executing);
                        }
                    }
                    else if (Action.complete.equals(action)) {
                        command.incrementStage();
                        command.complete(new Form(requestData.getForm()));
                        response.setStatus(Status.completed);
                        // Remove the completed session
                        executingCommands.remove(sessionId);
                    }
                    else if (Action.prev.equals(action)) {
View Full Code Here

        this.moderated = info.containsFeature("muc_moderated");
        this.nonanonymous = info.containsFeature("muc_nonanonymous");
        this.passwordProtected = info.containsFeature("muc_passwordprotected");
        this.persistent = info.containsFeature("muc_persistent");
        // Get the information based on the discovered extended information
        Form form = Form.getFormFrom(info);
        if (form != null) {
            FormField descField = form.getField("muc#roominfo_description");
            this.description = ( descField == null || !(descField.getValues().hasNext()) )? "" : descField.getValues().next();

            FormField subjField = form.getField("muc#roominfo_subject");
            this.subject = ( subjField == null || !(subjField.getValues().hasNext()) ) ? "" : subjField.getValues().next();

            FormField occCountField = form.getField("muc#roominfo_occupants");
            this.occupantsCount = occCountField == null ? -1 : Integer.parseInt(occCountField.getValues()
                    .next());
        }
    }
View Full Code Here

TOP

Related Classes of org.jivesoftware.smackx.Form

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.