/** * Returns the Occupant information for a particular occupant, or <tt>null</tt> if the * user is not in the room. The Occupant object may include information such as full * JID of the user as well as the role and affiliation of the user in the room.<p> * * @param user the room occupant to search for his presence. The format of user must * be: roomName@service/nickname (e.g. darkcave@macbeth.shakespeare.lit/thirdwitch). * @return the Occupant or <tt>null</tt> if the user is unavailable (i.e. not in the room). */ public Occupant getOccupant(EntityFullJid user) { Presence presence = getOccupantPresence(user); if (presence != null) { return new Occupant(presence); } return null; }
/** * Returns a list of <code>Occupant</code> that have the specified room role. * * @param role the role of the occupant in the room. * @return a list of <code>Occupant</code> that have the specified room role. * @throws XMPPErrorException if an error occured while performing the request to the server or you * don't have enough privileges to get this information. * @throws NoResponseException if there was no response from the server. * @throws NotConnectedException * @throws InterruptedException */ private List<Occupant> getOccupants(MUCRole role) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { MUCAdmin iq = new MUCAdmin(); iq.setTo(room); iq.setType(IQ.Type.get); // Set the specified role. This may request the list of moderators/participants. MUCItem item = new MUCItem(role); iq.addItem(item); MUCAdmin answer = (MUCAdmin) connection.createStanzaCollectorAndSend(iq).nextResultOrThrow(); // Get the list of participants from the server's answer List<Occupant> participants = new ArrayList<Occupant>(); for (MUCItem mucadminItem : answer.getItems()) { participants.add(new Occupant(mucadminItem)); } return participants; }
/** * Returns the Occupant information for a particular occupant, or <tt>null</tt> if the * user is not in the room. The Occupant object may include information such as full * JID of the user as well as the role and affiliation of the user in the room.<p> * * @param user the room occupant to search for his presence. The format of user must * be: roomName@service/nickname (e.g. darkcave@macbeth.shakespeare.lit/thirdwitch). * @return the Occupant or <tt>null</tt> if the user is unavailable (i.e. not in the room). */ public Occupant getOccupant(String user) { Presence presence = occupantsMap.get(user); if (presence != null) { return new Occupant(presence); } return null; }
/** * Returns the Occupant information for a particular occupant, or <tt>null</tt> if the * user is not in the room. The Occupant object may include information such as full * JID of the user as well as the role and affiliation of the user in the room.<p> * * @param user the room occupant to search for his presence. The format of user must * be: roomName@service/nickname (e.g. darkcave@macbeth.shakespeare.lit/thirdwitch). * @return the Occupant or <tt>null</tt> if the user is unavailable (i.e. not in the room). */ public Occupant getOccupant(String user) { Presence presence = (Presence) occupantsMap.get(user); if (presence != null) { return new Occupant(presence); } return null; }
/** * Returns the Occupant information for a particular occupant, or <tt>null</tt> if the * user is not in the room. The Occupant object may include information such as full * JID of the user as well as the role and affiliation of the user in the room.<p> * * @param user the room occupant to search for his presence. The format of user must * be: roomName@service/nickname (e.g. darkcave@macbeth.shakespeare.lit/thirdwitch). * @return the Occupant or <tt>null</tt> if the user is unavailable (i.e. not in the room). */ public Occupant getOccupant(String user) { Presence presence = occupantsMap.get(user); if (presence != null) { return new Occupant(presence); } return null; }
/** * Returns the Occupant information for a particular occupant, or <tt>null</tt> if the * user is not in the room. The Occupant object may include information such as full * JID of the user as well as the role and affiliation of the user in the room.<p> * * @param user the room occupant to search for his presence. The format of user must * be: roomName@service/nickname (e.g. darkcave@macbeth.shakespeare.lit/thirdwitch). * @return the Occupant or <tt>null</tt> if the user is unavailable (i.e. not in the room). */ public Occupant getOccupant(String user) { Presence presence = occupantsMap.get(user); if (presence != null) { return new Occupant(presence); } return null; }
participants.add(new Occupant((MUCAdmin.Item) it.next()));
participants.add(new Occupant((MUCAdmin.Item) it.next()));
participants.add(new Occupant(it.next()));
participants.add(new Occupant((MUCAdmin.Item) it.next()));