XMPP Group showing room to all users

89 views Asked by At

Working on XMPP Groupchat in iOS. I am successfully able to create a group using below code

NSString *groupName=[NSString stringWithFormat:@"%@@conference.myserver.com",self.groupNameTxtFld.text];
  XMPPJID *roomJID = [XMPPJID jidWithString:groupName];
  self.xmppRoom = [[XMPPRoom alloc] initWithRoomStorage:[[self xmppSharedManager] roomStorage]
                                                    jid:roomJID
                                          dispatchQueue:dispatch_get_main_queue()];

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

  [self.xmppRoom joinRoomUsingNickname:[self xmppSharedManager].xmppStream.myJID.user
                               history:nil
                              password:nil];

After creation of group doing the configuration.

- (void)xmppRoom:(XMPPRoom *)sender didFetchConfigurationForm:(NSXMLElement *)configForm
{
NSXMLElement *newConfig = [configForm copy];
NSArray *fields = [newConfig elementsForName:@"field"];

for (NSXMLElement *field in fields)
{
NSString *var = [field attributeStringValueForName:@"var"];
// Make Room Persistent

if ([var isEqualToString:@"muc#roomconfig_persistentroom"]) {
[field removeChildAtIndex:0];
[field addChild:[NSXMLElement elementWithName:@"value" stringValue:@"1"]];
}
}

[sender configureRoomUsingOptions:newConfig];

}

Fetching group by sending below request

 XMPPJID *servrJID = [XMPPJID jidWithString:@"conference.myserver.com"];
    XMPPIQ *iq = [XMPPIQ iqWithType:@"get" to:servrJID];
    [iq addAttributeWithName:@"from" stringValue:[[[[self xmppSharedManager] xmppStream] myJID] full]];
    NSXMLElement *query = [NSXMLElement elementWithName:@"query"];
    [query addAttributeWithName:@"xmlns" stringValue:@"http://jabber.org/protocol/disco#items"];
    [iq addChild:query];
    [[[self xmppSharedManager] xmppStream] sendElement:iq];

The problem I am facing is, The newly created group can see my all rosters without sending invitation. I need to show the group on acceptance of group request. Please suggest me where I am doing wrong

0

There are 0 answers