use of org.jivesoftware.smackx.muclight.MUCLightRoomConfiguration in project Smack by igniterealtime.
the class MUCLightConfigurationIQProvider method parse.
@Override
public MUCLightConfigurationIQ parse(XmlPullParser parser, int initialDepth) throws Exception {
String version = null;
String roomName = null;
String subject = null;
HashMap<String, String> customConfigs = null;
outerloop: while (true) {
int eventType = parser.next();
if (eventType == XmlPullParser.START_TAG) {
if (parser.getName().equals("version")) {
version = parser.nextText();
} else if (parser.getName().equals("roomname")) {
roomName = parser.nextText();
} else if (parser.getName().equals("subject")) {
subject = parser.nextText();
} else {
if (customConfigs == null) {
customConfigs = new HashMap<>();
}
customConfigs.put(parser.getName(), parser.nextText());
}
} else if (eventType == XmlPullParser.END_TAG) {
if (parser.getDepth() == initialDepth) {
break outerloop;
}
}
}
MUCLightRoomConfiguration configuration = new MUCLightRoomConfiguration(roomName, subject, customConfigs);
return new MUCLightConfigurationIQ(version, configuration);
}
use of org.jivesoftware.smackx.muclight.MUCLightRoomConfiguration in project Smack by igniterealtime.
the class MUCLightInfoIQProvider method parse.
@Override
public MUCLightInfoIQ parse(XmlPullParser parser, int initialDepth) throws Exception {
String version = null;
String roomName = null;
String subject = null;
HashMap<String, String> customConfigs = null;
HashMap<Jid, MUCLightAffiliation> occupants = new HashMap<>();
outerloop: while (true) {
int eventType = parser.next();
if (eventType == XmlPullParser.START_TAG) {
if (parser.getName().equals("version")) {
version = parser.nextText();
}
if (parser.getName().equals("configuration")) {
int depth = parser.getDepth();
outerloop2: while (true) {
eventType = parser.next();
if (eventType == XmlPullParser.START_TAG) {
if (parser.getName().equals("roomname")) {
roomName = parser.nextText();
} else if (parser.getName().equals("subject")) {
subject = parser.nextText();
} else {
if (customConfigs == null) {
customConfigs = new HashMap<>();
}
customConfigs.put(parser.getName(), parser.nextText());
}
} else if (eventType == XmlPullParser.END_TAG) {
if (parser.getDepth() == depth) {
break outerloop2;
}
}
}
}
if (parser.getName().equals("occupants")) {
occupants = iterateOccupants(parser);
}
} else if (eventType == XmlPullParser.END_TAG) {
if (parser.getDepth() == initialDepth) {
break outerloop;
}
}
}
return new MUCLightInfoIQ(version, new MUCLightRoomConfiguration(roomName, subject, customConfigs), occupants);
}
Aggregations