mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2025-09-10 10:49:41 +02:00
improved Delay Information Parser (fixes SMACK-243)
git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@11823 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
parent
8b54f34153
commit
7e01c66374
8 changed files with 496 additions and 56 deletions
|
@ -19,10 +19,13 @@
|
|||
*/
|
||||
package org.jivesoftware.smackx.provider;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.util.Date;
|
||||
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smack.provider.IQProvider;
|
||||
import org.jivesoftware.smack.util.StringUtils;
|
||||
import org.jivesoftware.smackx.packet.DataForm;
|
||||
import org.jivesoftware.smackx.packet.DelayInformation;
|
||||
import org.jivesoftware.smackx.packet.StreamInitiation;
|
||||
import org.jivesoftware.smackx.packet.StreamInitiation.File;
|
||||
import org.xmlpull.v1.XmlPullParser;
|
||||
|
@ -90,10 +93,19 @@ public class StreamInitiationProvider implements IQProvider {
|
|||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
Date fileDate = new Date();
|
||||
if (date != null) {
|
||||
try {
|
||||
fileDate = StringUtils.parseXEP0082Date(date);
|
||||
} catch (ParseException e) {
|
||||
// couldn't parse date, use current date-time
|
||||
}
|
||||
}
|
||||
|
||||
File file = new File(name, fileSize);
|
||||
file.setHash(hash);
|
||||
if (date != null)
|
||||
file.setDate(DelayInformation.UTC_FORMAT.parse(date));
|
||||
file.setDate(fileDate);
|
||||
file.setDesc(desc);
|
||||
file.setRanged(isRanged);
|
||||
initiation.setFile(file);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue