mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-22 14:22:05 +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));
|
adHocCommandData.setForm(dataFormProvider.parse(parser));
|
||||||
}
|
}
|
||||||
else if (parser.getName().equals("note")) {
|
else if (parser.getName().equals("note")) {
|
||||||
AdHocCommandNote.Type type = AdHocCommandNote.Type.valueOf(
|
String typeString = parser.getAttributeValue("", "type");
|
||||||
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();
|
String value = parser.nextText();
|
||||||
adHocCommandData.addNote(new AdHocCommandNote(type, value));
|
adHocCommandData.addNote(new AdHocCommandNote(type, value));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue