XMPPFramework icon indicating copy to clipboard operation
XMPPFramework copied to clipboard

How to get members list for group chat members other than admin/moderator

Open vicky1787 opened this issue 11 years ago • 7 comments

Hello Team,

Hello Team,

I am facing issue same as this link stated (https://github.com/esl/MongooseIM/issues/404) , Can you please advice on this. I want the members to show the settings page like whatsapp to list all members who are admin and members in that group. What would be the current way to achieve this.

http://cocoadocs.org/docsets/XMPPFramework/3.6.4/Protocols/XMPPRoomDelegate.html

Referring to the above link I do see the requirement functions given as below. But how should I use them in IOS Robbiehanson framework

– xmppRoom:didFetchMembersList: – xmppRoom:didNotFetchMembersList:

vicky1787 avatar Nov 09 '15 05:11 vicky1787

Hi Team,

I added the getmemberlist xml node in sendConfig even though server not giving this XML node. I get bad request can you please help.

2015-11-11 13:12:40:872 APP_NAME[4085:d30b] RECV: <iq xmlns="jabber:client" from="mucgrp-79e7451a-1dd1-4937-a98a-7250693d7a22-1447218709.274776@muc.dev.server.com" to="[email protected]/iOS" id="5F4214AE-1FB7-48BF-928A-78C689A33F89" type="error"><query xmlns="http://jabber.org/protocol/muc#owner"><x xmlns="jabber:x:data" type="submit"><title>Configuration of room mucgrp-79e7451a-1dd1-4937-a98a-7250693d7a22-1447218709.274776@muc.dev.servercom</title><field type="hidden" var="FORM_TYPE"><value>http://jabber.org/protocol/muc#roomconfig</value></field><field type="text-single" label="Room title" var="muc#roomconfig_roomname"><value>asdadsd</value></field><field type="text-single" label="Room description" var="muc#roomconfig_roomdesc"><value>asdadsd</value></field><field type="boolean" label="Make room persistent" var="muc#roomconfig_persistentroom"><value>1</value></field><field type="boolean" label="Make room public searchable" var="muc#roomconfig_publicroom"><value>1</value></field><field type="boolean" label="Make participants list public" var="public_list"><value>1</value></field><field type="boolean" label="Make room password protected" var="muc#roomconfig_passwordprotectedroom"><value>0</value></field><field type="text-private" label="Password" var="muc#roomconfig_roomsecret"><value/></field><field type="list-single" label="Maximum Number of Occupants" var="muc#roomconfig_maxusers"><option label="5"><value>5</value></option><option label="10"><value>10</value></option><option label="20"><value>20</value></option><option label="30"><value>30</value></option><option label="50"><value>50</value></option><option label="100"><value>100</value></option><option label="200"><value>200</value></option><option label="500"><value>500</value></option><value>50</value></field><field type="list-single" label="Present real Jabber IDs to" var="muc#roomconfig_whois"><option label="moderators only"><value>moderators</value></option><option label="anyone"><value>anyone</value></option><value>anyone</value></field><field type="boolean" label="Make room members-only" var="muc#roomconfig_membersonly"><value>0</value></field><field type="boolean" label="Make room moderated" var="muc#roomconfig_moderatedroom"><value>1</value></field><field type="boolean" label="Default users as participants" var="members_by_default"><value>1</value></field><field type="boolean" label="Allow users to change the subject" var="muc#roomconfig_changesubject"><value>1</value></field><field type="boolean" label="Allow users to send private messages" var="allow_private_messages"><value>0</value></field><field type="boolean" label="Allow users to query other users" var="allow_query_users"><value>1</value></field><field type="boolean" label="Allow users to send invites" var="muc#roomconfig_allowinvites"><value>0</value></field><field type="boolean" label="Allow users to enter room with multiple sessions" var="muc#roomconfig_allowmultisessions"><value>0</value></field><field type="boolean" label="Allow visitors to send status text in presence updates" var="muc#roomconfig_allowvisitorstatus"><value>1</value></field><field type="boolean" label="Allow visitors to change nickname" var="muc#roomconfig_allowvisitornickchange"><value>0</value></field><field type="boolean" label="Enable logging" var="muc#roomconfig_enablelogging"><value>1</value></field><field type="list-multi" label="Roles and Affiliations that May Retrieve Member List" var="muc#roomconfig_getmemberlist"><value>moderator</value><value>participant</value><value>visitor</value></field></x></query><error code="400" type="modify"><bad-request xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/></error></iq>

I cant fetch the member list of participants and moderators even if I am owner or participant or visitor.

Any quick help is truly appreciated.

vicky1787 avatar Nov 11 '15 05:11 vicky1787

i have the same question

benphamx avatar Dec 08 '15 03:12 benphamx

I resolved this by understand more on the roles and affiliations.

  1. Roles are temporary and are only shows with members who are in room and active
  2. Affiliations remain throughout the lifetime of a group entity in server

Hence we should request the affiliation for all the members that what we are doing for now and getting all the owner/member and admin list .

WE send the IQ to get the admin list for example as below.

NSXMLElement *adminElement = [NSXMLElement elementWithName:@"iq"]; [adminElement addAttributeWithName:@"to" stringValue:[[room roomJID] bare]]; [adminElement addAttributeWithName:@"id" stringValue:@"adminlist"]; [adminElement addAttributeWithName:@"type" stringValue:@"get"]; NSXMLElement *queryElement = [NSXMLElement elementWithName:@"query"]; [queryElement addAttributeWithName:@"xmlns" stringValue:@"http://jabber.org/protocol/muc#admin"]; NSXMLElement *itemElement = [NSXMLElement elementWithName:@"item"]; [itemElement addAttributeWithName:@"affiliation" stringValue:@"admin"]; [queryElement addChild:itemElement]; [adminElement addChild:queryElement]; [xmppStream sendElement:adminElement];

We get the response in the didReceiveIQ where we parse the result list.

And then accordingly more that this list the members are by default moderators which may or may not be present in the room..

Thanks Vicky

vicky1787 avatar Dec 08 '15 06:12 vicky1787

@vickyrappier how can you get list owner sir? if i was a member/participant i cannot get list owner/admin here

khanhvu161188 avatar Dec 10 '15 18:12 khanhvu161188

Hello khanhvu161188,

Please send this IQ Request and You should get the IQ Result with All Affiliation types Except “NONE”

Please Invite user and assign privilege to them as “Admin/Member/Owner” While you being owner or admin to give privileges.

REQUEST IQ:

RESPONSE IQ RESULT

"<iq xmlns=""jabber:client"" from=""[email protected]"" to=""[email protected]/iOS"" id=""ownerlist"" type=""result""><query xmlns=""http://jabber.org/protocol/muc#admin""><item affiliation=""owner"" jid=""[email protected]""/> "

Thanks, Regards, Vicky S Dhas

From: khanhvu161188 Reply-To: robbiehanson/XMPPFramework Date: Friday, 11 December 2015 at 2:58 AM To: robbiehanson/XMPPFramework Cc: vickydhas Subject: Re: [XMPPFramework] How to get members list for group chat members other than admin/moderator (#623)

@vickyrappier how can you get list owner sir? if i was a member/participant i cannot get list owner/admin here

— Reply to this email directly or view it on GitHub.

vicky1787 avatar Dec 11 '15 07:12 vicky1787

@vickyrappier I have the same problem, when the room created by me,I can fetch members success else fetch failed, Where the REQUEST IQ Code I should send?????

codeliujun avatar Aug 12 '16 09:08 codeliujun

Use roomconfig_whois and set to anyone.

vikram17000 avatar Nov 18 '16 15:11 vikram17000