private static DataForm createDefaultInitiationForm() { DataForm form = new DataForm(DataForm.Type.form); FormField field = new FormField(STREAM_DATA_FIELD_NAME); field.setType(FormField.Type.list_single); if (!IBB_ONLY) { field.addOption(new FormField.Option(Bytestream.NAMESPACE)); } field.addOption(new FormField.Option(DataPacketExtension.NAMESPACE)); form.addField(field); return form; } }
/** * Create a decorator from an existing {@link Form} for node configuration. * Typically, this can be used to create a decorator for an answer form * by using the result of {@link #createAnswerForm()} as the input parameter. * * @param nodeConfigForm */ public ConfigureForm(Form nodeConfigForm) { super(nodeConfigForm.getDataFormToSend()); }
/** * Check if the room supports a members only configuration. * * @return <code>true</code> if supported, <code>false</code> if not. */ public boolean supportsMembersOnly() { return answerForm.hasField(MUC_ROOMCONFIG_MEMBERSONLY); }
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.execute(answerForm); assert (command.isCompleted()); } }
/** * Adds the given Date as XEP-0082 formated string by invoking {@link #addValue(CharSequence)} after the date * instance was formated. * * @param date the date instance to add as XEP-0082 formated string. * @since 4.3.0 */ public void addValue(Date date) { String dateString = XmppDateTime.formatXEP0082Date(date); addValue(dateString); }
@Override public int compare(FormField f1, FormField f2) { return f1.getVariable().compareTo(f2.getVariable()); } });
private static void validateThatFieldIsText(FormField field) { switch (field.getType()) { case text_multi: case text_private: case text_single: break; default: throw new IllegalArgumentException("This field is not of type text (multi, private or single)."); } }
@Override public String toString() { return getLabel(); }
@Override public void connectionCreated(XMPPConnection connection) { getInstanceFor(connection); } });
@Override public String toString() { switch (this) { case bool: return "boolean"; default: return this.name().replace('_', '-'); } }
private static String getSingleValue(FormField formField) { List<String> values = formField.getValuesAsString(); if (values.isEmpty()) { return ""; } else { return values.get(0); } }
public Builder limitResultsToJid(Jid withJid) { if (withJid == null) { return this; } FormField formField = getWithFormField(withJid); formFields.put(formField.getVariable(), formField); return this; }
public SubscribeForm(Form subscribeOptionsForm) { super(subscribeOptionsForm.getDataFormToSend()); }
/** * Check if the room supports password protection. * * @return <code>true</code> if supported, <code>false</code> if not. */ public boolean supportsPasswordProtected() { return answerForm.hasField(MUC_ROOMCONFIG_PASSWORDPROTECTEDROOM); }
/** * Sets the form of the current stage. This should be used when setting a * response. It could be a form to fill out the information needed to go to * the next stage or the result of an execution. * * @param form the form of the current stage to fill out or the result of the * execution. */ protected void setForm(Form form) { data.setForm(form.getDataFormToSend()); }
private JoinQueuePacket(EntityBareJid workgroup, Form answerForm, Jid userID) { super("join-queue", "http://jabber.org/protocol/workgroup"); this.userID = userID; setTo(workgroup); setType(IQ.Type.set); form = answerForm.getDataFormToSend(); addExtension(form); }