0

Referring to this I am implementing a group chat configuration.

XMPPFramework - Implement Group Chat (MUC)

However as participant and not moderator I am unable to get the members list. I have tried reading multiple stack answers asking to implement the 'muc#roomconfig_getmemberlist' however the fetchconfiguration delegate of XMPPRoom is not giving this field value in the callback.

Can anybody advice which is the exact way to implement this also how can I fetch the member list.

Community
  • 1
  • 1
codelover
  • 1,113
  • 10
  • 28

2 Answers2

1

Create xmpp room using

/**
 This fuction is used to setup room with roomId
 */
-(void)setUpRoom:(NSString *)ChatRoomJID
{
    if (!ChatRoomJID)
    {
        return;
    }
    // Configure xmppRoom
    XMPPRoomMemoryStorage *roomMemoryStorage = [[XMPPRoomMemoryStorage alloc] init];

    XMPPJID *roomJID = [XMPPJID jidWithString:ChatRoomJID];

    xmppRoom = [[XMPPRoom alloc] initWithRoomStorage:roomMemoryStorage jid:roomJID dispatchQueue:dispatch_get_main_queue()];

    [xmppRoom activate:xmppStream];
    [xmppRoom addDelegate:self delegateQueue:dispatch_get_main_queue()];

    NSXMLElement *history = [NSXMLElement elementWithName:@"history"];
    [history addAttributeWithName:@" maxchars" stringValue:@"0"];
    [xmppRoom joinRoomUsingNickname:xmppStream.myJID.user
                            history:history
                           password:nil];


    [self performSelector:@selector(ConfigureNewRoom:) withObject:nil afterDelay:4];

}

/**
 This fuction is used configure new
 */
- (void)ConfigureNewRoom:(id)sender
{
    [xmppRoom configureRoomUsingOptions:nil];
    [xmppRoom fetchConfigurationForm];
    [xmppRoom fetchBanList];
    [xmppRoom fetchMembersList];
    [xmppRoom fetchModeratorsList];

}

After the creation of room use Delegate methods of Xmpp room

- (void)xmppRoom:(XMPPRoom *)sender occupantDidJoin:(XMPPJID *)occupantJID withPresence:(XMPPPresence *)presence


- (void)xmppRoom:(XMPPRoom *)sender occupantDidLeave:(XMPPJID *)occupantJID withPresence:(XMPPPresence *)presence

using these two delegate methods you can easily maintain list of users joined to MUC Room

samanvith
  • 39
  • 3
  • Thanks Samanvith, I can get these delegates and hence not needed to set this in settings configuration to server as 'muc#roomconfig_getmemberlist' since its by default ON in Server. thanks for the info though. – codelover Jan 28 '16 at 07:38
0

This is by default enabled configuration in server so just no need to set, we have to customise the server to get the members even offline and left room. so to achieve the requirement like other chats app members to be displayed.

codelover
  • 1,113
  • 10
  • 28