Search in sources :

Example 1 with MUCLightAffiliationsIQ

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();
}
Also used : MUCLightAffiliationsIQ(org.jivesoftware.smackx.muclight.element.MUCLightAffiliationsIQ) MUCLightGetAffiliationsIQ(org.jivesoftware.smackx.muclight.element.MUCLightGetAffiliationsIQ) MUCLightDestroyIQ(org.jivesoftware.smackx.muclight.element.MUCLightDestroyIQ) MUCLightChangeAffiliationsIQ(org.jivesoftware.smackx.muclight.element.MUCLightChangeAffiliationsIQ) MUCLightConfigurationIQ(org.jivesoftware.smackx.muclight.element.MUCLightConfigurationIQ) MUCLightInfoIQ(org.jivesoftware.smackx.muclight.element.MUCLightInfoIQ) MUCLightGetAffiliationsIQ(org.jivesoftware.smackx.muclight.element.MUCLightGetAffiliationsIQ) MUCLightGetConfigsIQ(org.jivesoftware.smackx.muclight.element.MUCLightGetConfigsIQ) MUCLightCreateIQ(org.jivesoftware.smackx.muclight.element.MUCLightCreateIQ) MUCLightAffiliationsIQ(org.jivesoftware.smackx.muclight.element.MUCLightAffiliationsIQ) MUCLightSetConfigsIQ(org.jivesoftware.smackx.muclight.element.MUCLightSetConfigsIQ) MUCLightGetInfoIQ(org.jivesoftware.smackx.muclight.element.MUCLightGetInfoIQ) IQ(org.jivesoftware.smack.packet.IQ)

Example 2 with MUCLightAffiliationsIQ

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")));
}
Also used : MUCLightAffiliationsIQ(org.jivesoftware.smackx.muclight.element.MUCLightAffiliationsIQ) Jid(org.jxmpp.jid.Jid) MUCLightAffiliationsIQ(org.jivesoftware.smackx.muclight.element.MUCLightAffiliationsIQ) MUCLightGetAffiliationsIQ(org.jivesoftware.smackx.muclight.element.MUCLightGetAffiliationsIQ) IQ(org.jivesoftware.smack.packet.IQ) Test(org.junit.Test)

Aggregations

IQ (org.jivesoftware.smack.packet.IQ)2 MUCLightAffiliationsIQ (org.jivesoftware.smackx.muclight.element.MUCLightAffiliationsIQ)2 MUCLightGetAffiliationsIQ (org.jivesoftware.smackx.muclight.element.MUCLightGetAffiliationsIQ)2 MUCLightChangeAffiliationsIQ (org.jivesoftware.smackx.muclight.element.MUCLightChangeAffiliationsIQ)1 MUCLightConfigurationIQ (org.jivesoftware.smackx.muclight.element.MUCLightConfigurationIQ)1 MUCLightCreateIQ (org.jivesoftware.smackx.muclight.element.MUCLightCreateIQ)1 MUCLightDestroyIQ (org.jivesoftware.smackx.muclight.element.MUCLightDestroyIQ)1 MUCLightGetConfigsIQ (org.jivesoftware.smackx.muclight.element.MUCLightGetConfigsIQ)1 MUCLightGetInfoIQ (org.jivesoftware.smackx.muclight.element.MUCLightGetInfoIQ)1 MUCLightInfoIQ (org.jivesoftware.smackx.muclight.element.MUCLightInfoIQ)1 MUCLightSetConfigsIQ (org.jivesoftware.smackx.muclight.element.MUCLightSetConfigsIQ)1 Test (org.junit.Test)1 Jid (org.jxmpp.jid.Jid)1