use of com.xabber.android.data.extension.references.RefMedia in project xabber-android by redsolution.
the class HttpFileUploadManager method parseFileMessage.
public static RealmList<Attachment> parseFileMessage(Stanza packet) {
RealmList<Attachment> attachments = new RealmList<>();
// parsing data references
List<RefMedia> refMediaList = ReferencesManager.getMediaFromReferences(packet);
if (!refMediaList.isEmpty()) {
for (RefMedia media : refMediaList) {
attachments.add(refMediaToAttachment(media));
}
}
// parsing data forms
DataForm dataForm = DataForm.from(packet);
if (dataForm != null) {
List<FormField> fields = dataForm.getFields();
for (FormField field : fields) {
if (field instanceof ExtendedFormField) {
ExtendedFormField.Media media = ((ExtendedFormField) field).getMedia();
attachments.add(mediaToAttachment(media, field.getLabel()));
}
}
}
return attachments;
}
Aggregations