Java 类org.jivesoftware.smackx.muc.MUCRole 实例源码

项目:Smack    文件:MUCParserUtils.java   
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);
}
项目:Smack    文件:MUCItem.java   
public MUCItem(MUCRole role) {
    this(null, role, null, null, null, null);
}
项目:Smack    文件:MUCItem.java   
public MUCItem(MUCRole role, String nick) {
    this(null, role, null, null, null, nick);
}
项目:Smack    文件:MUCItem.java   
public MUCItem(MUCRole role, String nick, String reason) {
    this(null, role, null, reason, null, nick);
}
项目:Smack    文件:MUCItem.java   
/**
 * 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;
}
项目:Smack    文件:MUCItem.java   
/**
 * Returns the temporary position or privilege level of an occupant within a room. The possible
 * roles are "moderator", "participant", "visitor" and "none" (it is also possible to have no defined
 * role). A role lasts only for the duration of an occupant's visit to a room.
 * 
 * @return the privilege level of an occupant within a room.
 */
public MUCRole getRole() {
    return role;
}