use of org.jivesoftware.smackx.mam.element.MamElementFactory in project Smack by igniterealtime.
the class MamResultProvider method parse.
@Override
public MamResultExtension parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException, ParseException {
MamElementFactory elementFactory = MamElementFactory.forParser(parser);
Forwarded<Message> forwarded = null;
String queryId = parser.getAttributeValue("", "queryid");
String id = parser.getAttributeValue("", "id");
outerloop: while (true) {
final XmlPullParser.Event eventType = parser.next();
switch(eventType) {
case START_ELEMENT:
final String name = parser.getName();
switch(name) {
case Forwarded.ELEMENT:
forwarded = ForwardedProvider.parseForwardedMessage(parser, xmlEnvironment);
break;
}
break;
case END_ELEMENT:
if (parser.getDepth() == initialDepth) {
break outerloop;
}
break;
default:
// Catch all for incomplete switch (MissingCasesInEnumSwitch) statement.
break;
}
}
return elementFactory.newResultExtension(queryId, id, forwarded);
}
use of org.jivesoftware.smackx.mam.element.MamElementFactory in project Smack by igniterealtime.
the class MamFinIQProvider method parse.
@Override
public MamFinIQ parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException {
MamElementFactory elementFactory = MamElementFactory.forParser(parser);
String queryId = parser.getAttributeValue("", "queryid");
boolean complete = ParserUtils.getBooleanAttribute(parser, "complete", false);
boolean stable = ParserUtils.getBooleanAttribute(parser, "stable", true);
RSMSet rsmSet = null;
outerloop: while (true) {
XmlPullParser.Event eventType = parser.next();
switch(eventType) {
case START_ELEMENT:
if (parser.getName().equals(RSMSet.ELEMENT)) {
rsmSet = RSMSetProvider.INSTANCE.parse(parser);
}
break;
case END_ELEMENT:
if (parser.getDepth() == initialDepth) {
break outerloop;
}
break;
default:
// Catch all for incomplete switch (MissingCasesInEnumSwitch) statement.
break;
}
}
return elementFactory.newFinIQ(queryId, rsmSet, complete, stable);
}
use of org.jivesoftware.smackx.mam.element.MamElementFactory in project Smack by igniterealtime.
the class MamPrefsIQProvider method parse.
@Override
public MamPrefsIQ parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
MamElementFactory elementFactory = MamElementFactory.forParser(parser);
String defaultBehaviorString = parser.getAttributeValue("", "default");
DefaultBehavior defaultBehavior = null;
if (defaultBehaviorString != null) {
defaultBehavior = DefaultBehavior.valueOf(defaultBehaviorString);
}
List<Jid> alwaysJids = null;
List<Jid> neverJids = null;
outerloop: while (true) {
final XmlPullParser.Event eventType = parser.next();
switch(eventType) {
case START_ELEMENT:
final String name = parser.getName();
switch(name) {
case "always":
alwaysJids = iterateJids(parser);
break;
case "never":
neverJids = iterateJids(parser);
break;
}
break;
case END_ELEMENT:
if (parser.getDepth() == initialDepth) {
break outerloop;
}
break;
default:
// Catch all for incomplete switch (MissingCasesInEnumSwitch) statement.
break;
}
}
return elementFactory.newPrefsIQ(alwaysJids, neverJids, defaultBehavior);
}
use of org.jivesoftware.smackx.mam.element.MamElementFactory in project Smack by igniterealtime.
the class MamQueryIQProvider method parse.
@Override
public MamQueryIQ parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException {
MamElementFactory elementFactory = MamElementFactory.forParser(parser);
DataForm dataForm = null;
String queryId = parser.getAttributeValue("", "queryid");
String node = parser.getAttributeValue("", "node");
outerloop: while (true) {
final XmlPullParser.Event eventType = parser.next();
switch(eventType) {
case START_ELEMENT:
final String name = parser.getName();
switch(name) {
case DataForm.ELEMENT:
dataForm = DataFormProvider.INSTANCE.parse(parser);
break;
}
break;
case END_ELEMENT:
if (parser.getDepth() == initialDepth) {
break outerloop;
}
break;
default:
// Catch all for incomplete switch (MissingCasesInEnumSwitch) statement.
break;
}
}
return elementFactory.newQueryIQ(queryId, node, dataForm);
}
Aggregations