return simpleUserSearch;
}
}
private static void buildDataForm(SimpleUserSearch search, String instructions, XmlPullParser parser) throws Exception {
DataForm dataForm = new DataForm(Form.TYPE_FORM);
boolean done = false;
dataForm.setTitle("User Search");
dataForm.addInstruction(instructions);
while (!done) {
int eventType = parser.next();
if (eventType == XmlPullParser.START_TAG && !parser.getNamespace().equals("jabber:x:data")) {
String name = parser.getName();
FormField field = new FormField(name);
// Handle hard coded values.
if(name.equals("first")){
field.setLabel("First Name");
}
else if(name.equals("last")){
field.setLabel("Last Name");
}
else if(name.equals("email")){
field.setLabel("Email Address");
}
else if(name.equals("nick")){
field.setLabel("Nickname");
}
field.setType(FormField.TYPE_TEXT_SINGLE);
dataForm.addField(field);
}
else if (eventType == XmlPullParser.END_TAG) {
if (parser.getName().equals("query")) {
done = true;
}