use of org.jivesoftware.smackx.delay.provider.DelayInformationProvider in project xabber-android by redsolution.
the class ForwardedProvider method parse.
@Override
public Forwarded parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, SmackException {
DelayInformationProvider delayInformationProvider = new DelayInformationProvider();
DelayInformation delayInformation = null;
Stanza packet = null;
boolean done = false;
while (!done) {
int eventType = parser.next();
if (eventType == XmlPullParser.START_TAG) {
if (parser.getName().equals("delay"))
delayInformation = delayInformationProvider.parse(parser);
else if (parser.getName().equals("message"))
packet = PacketParserUtils.parseMessage(parser);
else
throw new SmackException("Unsupported forwarded packet type: " + parser.getName());
} else if (eventType == XmlPullParser.END_TAG && parser.getName().equals(Forwarded.ELEMENT_NAME))
done = true;
}
if (packet == null)
throw new SmackException("forwarded extension must contain a packet");
return new Forwarded(delayInformation, packet);
}
Aggregations