导航菜单

页面标题

页面副标题

Housing v14.7.8 - Occupant.java 源代码

正在查看: Housing v14.7.8 应用的 Occupant.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package org.jivesoftware.smackx.muc;

import org.jivesoftware.smack.packet.Presence;
import org.jivesoftware.smackx.muc.packet.MUCItem;
import org.jivesoftware.smackx.muc.packet.MUCUser;
import org.jxmpp.util.XmppStringUtils;

public class Occupant {
    private final MUCAffiliation affiliation;
    private final String jid;
    private final String nick;
    private final MUCRole role;

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

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

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

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

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

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

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

    public Occupant(MUCItem mUCItem) {
        this.jid = mUCItem.getJid();
        this.affiliation = mUCItem.getAffiliation();
        this.role = mUCItem.getRole();
        this.nick = mUCItem.getNick();
    }
}