1 20 21 package org.jivesoftware.smackx.muc; 22 23 import org.jivesoftware.smackx.packet.MUCAdmin; 24 import org.jivesoftware.smackx.packet.MUCUser; 25 import org.jivesoftware.smack.packet.Presence; 26 import org.jivesoftware.smack.util.StringUtils; 27 28 34 public class Occupant { 35 private String affiliation; 37 private String role; 38 private String jid; 40 private String nick; 41 42 Occupant(MUCAdmin.Item item) { 43 super(); 44 this.jid = item.getJid(); 45 this.affiliation = item.getAffiliation(); 46 this.role = item.getRole(); 47 this.nick = item.getNick(); 48 } 49 50 Occupant(Presence presence) { 51 super(); 52 MUCUser mucUser = (MUCUser) presence.getExtension("x", 53 "http://jabber.org/protocol/muc#user"); 54 MUCUser.Item item = mucUser.getItem(); 55 this.jid = item.getJid(); 56 this.affiliation = item.getAffiliation(); 57 this.role = item.getRole(); 58 this.nick = StringUtils.parseResource(presence.getFrom()); 60 } 61 62 70 public String getJid() { 71 return jid; 72 } 73 74 80 public String getAffiliation() { 81 return affiliation; 82 } 83 84 90 public String getRole() { 91 return role; 92 } 93 94 101 public String getNick() { 102 return nick; 103 } 104 } 105 | Popular Tags |