5

I'm trying to fetch joined member list from particular group based on room JID, there are couple of method exists, mentioned below:

  • MultiUserChat.getMembers(); It return XMPPError: forbidden - auth
  • MultiUserChat.getOccupants(); It return self info only
  • MultiUserChat.getParticipants(); It returnXMPPError: forbidden - auth

But none of working getting exception XMPPError: forbidden - auth, it seem there is something issue with privacy,which I'm not able to figure out.

Note: JID the name of the room in the form "roomName@service"

RobinHood
  • 10,897
  • 4
  • 48
  • 97
  • I believe getOccupants() is correct, but it should return more than just yourself (assuming there are others in the room of course...) – MattJ Dec 11 '15 at 21:39
  • yes, you are correct, but I'm also surprised, does `Broadcast Presence for: Moderator/Participant/Visitor` in room effect to `getOccupants()`? – RobinHood Dec 12 '15 at 05:40
  • Yes, it will only return who is currently in the room. Anyone who is offlne will not be returned. To get offline members you can use getMembers() and the others, but depending on the server and its configuration, you may not have permission to view these lists. – MattJ Dec 13 '15 at 12:18
  • But its not working as it has to, it only return self detail instead all joined member list. [This is room detail](http://s23.postimg.org/q4j33kbnv/Untitled.png) – RobinHood Dec 14 '15 at 07:07

2 Answers2

0

As per xmpp documents room/group should be non anonymous to retrieve all members list. So try to set anonymous = false in .yml or configuration file at server side or you can set that also in configuration while creating rooms.

Please not that affiliation should at-least member to retrieve member list

iosdev1111
  • 1,048
  • 1
  • 13
  • 32
-1
Use this :

multiUserChatManager = MultiUserChatManager.getInstanceFor(XMPPConnection);
MultiUserChat muc =multiUserChatManager.getMultiUserChat("dopee@conference.104.155.155.5");
        try {
            List<Affiliate> admin=muc.getAdmins();
            System.out.println("Admin=====>>>"+admin);
            List<String> userlist=muc.getOccupants();
            List<Affiliate> member=muc.getMembers();
            List<Occupant> memBer=muc.getParticipants();
            List<Affiliate> owner=muc.getOwners();

            System.out.println("userlist=====>>>"+ userlist.toString());
            System.out.println("usercount=====>>>"+   muc.getOccupantsCount());
        } catch (SmackException.NoResponseException e) {
            e.printStackTrace();
        } catch (XMPPException.XMPPErrorException e) {
            e.printStackTrace();
        } catch (SmackException.NotConnectedException e) {
            e.printStackTrace();
        }