public static MUCItem parseItem(XmlPullParser parser) throws XmlPullParserException, IOException { int initialDepth = parser.getDepth(); MUCAffiliation affiliation = MUCAffiliation.fromString(parser.getAttributeValue("", "affiliation")); String nick = parser.getAttributeValue("", "nick"); MUCRole role = MUCRole.fromString(parser.getAttributeValue("", "role")); String jid = parser.getAttributeValue("", "jid"); String actor = null; String reason = null; outerloop: while (true) { int eventType = parser.next(); switch (eventType) { case XmlPullParser.START_TAG: String name = parser.getName(); switch (name) { case "actor": actor = parser.getAttributeValue("", "jid"); break; case "reason": reason = parser.nextText(); break; } break; case XmlPullParser.END_TAG: if (parser.getDepth() == initialDepth) { break outerloop; } break; } } return new MUCItem(affiliation, role, actor, reason, jid, nick); }
public MUCItem(MUCAffiliation affiliation) { this(affiliation, null, null, null, null, null); }
public MUCItem(MUCAffiliation affiliation, String jid, String reason) { this(affiliation, null, null, reason, jid, null); }
public MUCItem(MUCAffiliation affiliation, String jid) { this(affiliation, null, null, null, jid, null); }
/** * Creates a new item child. * * @param affiliation the actor's affiliation to the room * @param role the privilege level of an occupant within a room. * @param actor * @param reason * @param jid * @param nick */ public MUCItem(MUCAffiliation affiliation, MUCRole role, String actor, String reason, String jid, String nick) { this.affiliation = affiliation; this.role = role; this.actor = actor; this.reason = reason; this.jid = jid; this.nick = nick; }
/** * Returns the occupant's affiliation to the room. The affiliation is a semi-permanent * association or connection with a room. The possible affiliations are "owner", "admin", * "member", and "outcast" (naturally it is also possible to have no affiliation). An * affiliation lasts across a user's visits to a room. * * @return the actor's affiliation to the room */ public MUCAffiliation getAffiliation() { return affiliation; }