/** * Returns a collection of <code>Affiliate</code> that have the specified room affiliation * sending a request in the admin namespace. * * @param affiliation the affiliation of the users in the room. * @return a collection of <code>Affiliate</code> that have the specified room affiliation. * @throws XMPPErrorException if 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<Affiliate> getAffiliatesByAdmin(MUCAffiliation affiliation) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { MUCAdmin iq = new MUCAdmin(); iq.setTo(room); iq.setType(IQ.Type.get); // Set the specified affiliation. This may request the list of owners/admins/members/outcasts. MUCItem item = new MUCItem(affiliation); iq.addItem(item); MUCAdmin answer = (MUCAdmin) connection.createStanzaCollectorAndSend(iq).nextResultOrThrow(); // Get the list of affiliates from the server's answer List<Affiliate> affiliates = new ArrayList<Affiliate>(); for (MUCItem mucadminItem : answer.getItems()) { affiliates.add(new Affiliate(mucadminItem)); } return affiliates; }
affiliates.add(new Affiliate(it.next()));
affiliates.add(new Affiliate((MUCAdmin.Item) it.next()));
affiliates.add(new Affiliate((MUCOwner.Item) it.next()));
affiliates.add(new Affiliate((MUCAdmin.Item) it.next()));
affiliates.add(new Affiliate((MUCOwner.Item) it.next()));
affiliates.add(new Affiliate((MUCOwner.Item) it.next()));
affiliates.add(new Affiliate((MUCAdmin.Item) it.next()));
affiliates.add(new Affiliate(it.next()));