mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-22 03:52:06 +01:00
mam: use new DataForm API in MamQueryIQ
Use the new API introduced with e58e6fa75
("xdata: add more helper
methods to DataForm") in MamQueryIQ.
This commit is contained in:
parent
e58e6fa75d
commit
661b2743d9
1 changed files with 4 additions and 5 deletions
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
*
|
||||
* Copyright © 2016 Florian Schmaus and Fernando Ramirez
|
||||
* Copyright © 2016-2020 Florian Schmaus and Fernando Ramirez
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -18,7 +18,6 @@ package org.jivesoftware.smackx.mam.element;
|
|||
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
|
||||
import org.jivesoftware.smackx.xdata.FormField;
|
||||
import org.jivesoftware.smackx.xdata.packet.DataForm;
|
||||
|
||||
/**
|
||||
|
@ -88,11 +87,11 @@ public class MamQueryIQ extends IQ {
|
|||
this.dataForm = dataForm;
|
||||
|
||||
if (dataForm != null) {
|
||||
FormField field = dataForm.getHiddenFormTypeField();
|
||||
if (field == null) {
|
||||
String formType = dataForm.getFormType();
|
||||
if (formType == null) {
|
||||
throw new IllegalArgumentException("If a data form is given it must posses a hidden form type field");
|
||||
}
|
||||
if (!field.getValues().get(0).toString().equals(MamElements.NAMESPACE)) {
|
||||
if (!formType.equals(MamElements.NAMESPACE)) {
|
||||
throw new IllegalArgumentException(
|
||||
"Value of the hidden form type field must be '" + MamElements.NAMESPACE + "'");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue