use of org.jivesoftware.smackx.carbons.packet.CarbonExtension.Direction in project Smack by igniterealtime.
the class CarbonManagerProvider method parse.
@Override
public CarbonExtension parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException, ParseException {
Direction dir = Direction.valueOf(parser.getName());
Forwarded<Message> fwd = null;
boolean done = false;
while (!done) {
XmlPullParser.Event eventType = parser.next();
if (eventType == XmlPullParser.Event.START_ELEMENT && parser.getName().equals("forwarded")) {
fwd = ForwardedProvider.parseForwardedMessage(parser, xmlEnvironment);
} else if (eventType == XmlPullParser.Event.END_ELEMENT && dir == Direction.valueOf(parser.getName()))
done = true;
}
if (fwd == null) {
throw new SmackParsingException("sent/received must contain exactly one <forwarded/> element");
}
return new CarbonExtension(dir, fwd);
}
use of org.jivesoftware.smackx.carbons.packet.CarbonExtension.Direction in project Smack by igniterealtime.
the class CarbonManagerProvider method parse.
@Override
public CarbonExtension parse(XmlPullParser parser, int initialDepth) throws Exception {
Direction dir = Direction.valueOf(parser.getName());
Forwarded fwd = null;
boolean done = false;
while (!done) {
int eventType = parser.next();
if (eventType == XmlPullParser.START_TAG && parser.getName().equals("forwarded")) {
fwd = FORWARDED_PROVIDER.parse(parser);
} else if (eventType == XmlPullParser.END_TAG && dir == Direction.valueOf(parser.getName()))
done = true;
}
if (fwd == null)
throw new SmackException("sent/received must contain exactly one <forwarded> tag");
return new CarbonExtension(dir, fwd);
}
Aggregations