1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2025-09-10 18:59:41 +02:00

SMACK-361 Added support for Entity Capabilities.

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/branches/smack_3_3_0@13560 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Florian Schmaus 2013-03-18 08:50:48 +00:00 committed by flow
parent 1cdb86989a
commit 21be8c55ee
33 changed files with 2395 additions and 88 deletions

View file

@ -21,6 +21,7 @@
package org.jivesoftware.smackx.packet;
import org.jivesoftware.smack.packet.PacketExtension;
import org.jivesoftware.smackx.Form;
import org.jivesoftware.smackx.FormField;
import java.util.ArrayList;
@ -123,11 +124,11 @@ public class DataForm implements PacketExtension {
}
public String getElementName() {
return "x";
return Form.ELEMENT;
}
public String getNamespace() {
return "jabber:x:data";
return Form.NAMESPACE;
}
/**
@ -195,6 +196,21 @@ public class DataForm implements PacketExtension {
}
}
/**
* Returns true if this DataForm has at least one FORM_TYPE field which is
* hidden. This method is used for sanity checks.
*
* @return
*/
public boolean hasHiddenFromTypeField() {
boolean found = false;
for (FormField f : fields) {
if (f.getVariable().equals("FORM_TYPE") && f.getType() != null && f.getType().equals("hidden"))
found = true;
}
return found;
}
public String toXML() {
StringBuilder buf = new StringBuilder();
buf.append("<").append(getElementName()).append(" xmlns=\"").append(getNamespace()).append(