曹妃甸核酸检测平台.apk(点击下载) / Occupant.java


package asmack.org.jivesoftware.smackx.muc;

import asmack.org.jivesoftware.smack.packet.Presence;
import asmack.org.jivesoftware.smack.util.StringUtils;
import asmack.org.jivesoftware.smackx.GroupChatInvitation;
import asmack.org.jivesoftware.smackx.packet.MUCAdmin;
import asmack.org.jivesoftware.smackx.packet.MUCUser;

public class Occupant {
    private String affiliation;
    private String jid;
    private String nick;
    private String role;

    Occupant(Presence presence) {
        MUCUser.Item item = ((MUCUser) presence.getExtension(GroupChatInvitation.ELEMENT_NAME, "http://jabber.org/protocol/muc#user")).getItem();
        this.jid = item.getJid();
        this.affiliation = item.getAffiliation();
        this.role = item.getRole();
        this.nick = StringUtils.parseResource(presence.getFrom());
    }

    Occupant(MUCAdmin.Item item) {
        this.jid = item.getJid();
        this.affiliation = item.getAffiliation();
        this.role = item.getRole();
        this.nick = item.getNick();
    }

    public boolean equals(Object obj) {
        if (!(obj instanceof Occupant)) {
            return false;
        }
        return this.jid.equals(((Occupant) obj).jid);
    }

    public String getAffiliation() {
        return this.affiliation;
    }

    public String getJid() {
        return this.jid;
    }

    public String getNick() {
        return this.nick;
    }

    public String getRole() {
        return this.role;
    }

    public int hashCode() {
        int hashCode = ((((this.affiliation.hashCode() * 17) + this.role.hashCode()) * 17) + this.jid.hashCode()) * 17;
        String str = this.nick;
        return hashCode + (str != null ? str.hashCode() : 0);
    }
}