use of org.jivesoftware.smackx.muclight.element.MUCLightAffiliationsIQ in project Smack by igniterealtime.
the class MultiUserChatLight method getAffiliations.
/**
* Get the MUC Light affiliations.
*
* @param version
* @return the room affiliations
* @throws NoResponseException
* @throws XMPPErrorException
* @throws NotConnectedException
* @throws InterruptedException
*/
public HashMap<Jid, MUCLightAffiliation> getAffiliations(String version) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
MUCLightGetAffiliationsIQ mucLightGetAffiliationsIQ = new MUCLightGetAffiliationsIQ(room, version);
IQ responseIq = connection.createStanzaCollectorAndSend(mucLightGetAffiliationsIQ).nextResultOrThrow();
MUCLightAffiliationsIQ mucLightAffiliationsIQ = (MUCLightAffiliationsIQ) responseIq;
return mucLightAffiliationsIQ.getAffiliations();
}
use of org.jivesoftware.smackx.muclight.element.MUCLightAffiliationsIQ in project Smack by igniterealtime.
the class MUCLightGetAffiliationsTest method checkGetAffiliationsResponse.
@Test
public void checkGetAffiliationsResponse() throws Exception {
IQ iqInfoResult = (IQ) PacketParserUtils.parseStanza(getAffiliationsResponseExample);
MUCLightAffiliationsIQ mucLightAffiliationsIQ = (MUCLightAffiliationsIQ) iqInfoResult;
Assert.assertEquals("123456", mucLightAffiliationsIQ.getVersion());
HashMap<Jid, MUCLightAffiliation> affiliations = mucLightAffiliationsIQ.getAffiliations();
Assert.assertEquals(3, affiliations.size());
Assert.assertEquals(MUCLightAffiliation.owner, affiliations.get(JidCreate.from("user1@shakespeare.lit")));
Assert.assertEquals(MUCLightAffiliation.member, affiliations.get(JidCreate.from("user2@shakespeare.lit")));
Assert.assertEquals(MUCLightAffiliation.member, affiliations.get(JidCreate.from("user3@shakespeare.lit")));
}
Aggregations