mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-12-22 10:37:59 +01:00
Ad-Hoc Commands: 'type' attribute is optional
Fixes SMACK-741
This commit is contained in:
parent
1b1e88c4c3
commit
d6ebb884e7
1 changed files with 8 additions and 2 deletions
|
@ -95,8 +95,14 @@ public class AdHocCommandDataProvider extends IQProvider<AdHocCommandData> {
|
|||
adHocCommandData.setForm(dataFormProvider.parse(parser));
|
||||
}
|
||||
else if (parser.getName().equals("note")) {
|
||||
AdHocCommandNote.Type type = AdHocCommandNote.Type.valueOf(
|
||||
parser.getAttributeValue("", "type"));
|
||||
String typeString = parser.getAttributeValue("", "type");
|
||||
AdHocCommandNote.Type type;
|
||||
if (typeString != null) {
|
||||
type = AdHocCommandNote.Type.valueOf(typeString);
|
||||
} else {
|
||||
// Type is optional and 'info' if not present.
|
||||
type = AdHocCommandNote.Type.info;
|
||||
}
|
||||
String value = parser.nextText();
|
||||
adHocCommandData.addNote(new AdHocCommandNote(type, value));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue