private Element addAffiliationToResult(String affiliation, Element parent, JID jid) { Element result = parent.addElement("item", "http://jabber.org/protocol/muc#admin"); result.addAttribute("affiliation", affiliation); result.addAttribute("jid", jid.toString()); try { List<MUCRole> roles = room.getOccupantsByBareJID(jid); MUCRole role = roles.get(0); result.addAttribute("role", role.getRole().toString()); result.addAttribute("nick", role.getNickname()); } catch (UserNotFoundException e) { // the JID is note currently an occupant } return result; } }
private Element addAffiliationToResult(String affiliation, Element parent, JID jid) { Element result = parent.addElement("item", "http://jabber.org/protocol/muc#admin"); result.addAttribute("affiliation", affiliation); result.addAttribute("jid", jid.toString()); try { List<MUCRole> roles = room.getOccupantsByBareJID(jid); MUCRole role = roles.get(0); result.addAttribute("role", role.getRole().toString()); result.addAttribute("nick", role.getNickname()); } catch (UserNotFoundException e) { // the JID is note currently an occupant } return result; } }
/** * Calculates and sets the extended presence information to add to the presence. * The information to add contains the user's jid, affiliation and role. */ private void calculateExtendedInformation() { ElementUtil.setProperty(extendedInformation, "x.item:jid", user.getAddress().toString()); ElementUtil.setProperty(extendedInformation, "x.item:affiliation", affiliation.toString()); ElementUtil.setProperty(extendedInformation, "x.item:role", role.toString()); updatePresence(); }
/** * Calculates and sets the extended presence information to add to the presence. * The information to add contains the user's jid, affiliation and role. */ private void calculateExtendedInformation() { ElementUtil.setProperty(extendedInformation, "x.item:jid", user.getAddress().toString()); ElementUtil.setProperty(extendedInformation, "x.item:affiliation", affiliation.toString()); ElementUtil.setProperty(extendedInformation, "x.item:role", role.toString()); updatePresence(); }