0

I want to add 4 members (who are already users in oprefire) to a group. I want to add them without user permission nor sending invitation

Right now i am inviting a user using this code:

[sender inviteUser:[XMPPJID jidWithString:@"keithoys"] withMessage:@"Greetings!"];

Is there some another way to achieve this?

Alex Salauyou
  • 14,185
  • 5
  • 45
  • 67
Kishore Suthar
  • 2,943
  • 4
  • 26
  • 44
  • 1
    possible duplicate of [Adding participants to XMPP chat rooms](http://stackoverflow.com/questions/14098075/adding-participants-to-xmpp-chat-rooms) – legoscia Apr 15 '15 at 10:08

1 Answers1

0

When user send request to other user, the following delegate method is called:

-(void)xmppMUC:(XMPPMUC *)sender roomJID:(XMPPJID *)roomJID didReceiveInvitation:(XMPPMessage *)message{

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

    [xmppRoom activate:[self xmppStream]];

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

    //Now add user to the group directly without prompting them
    [xmppRoom joinRoomUsingNickname:[xmppStream myJID].user history:nil];
}

I've only written the code, if you need explanation, i'll.

Bista
  • 7,869
  • 3
  • 27
  • 55
  • Hello @the_UB, How to retrieve data from roomMemoryStorage? – Sushil Sharma May 05 '15 at 09:20
  • Why do you want to retrieve data? – Bista May 05 '15 at 17:23
  • I have to show list of rooms (that a user is owner or member of) in a tableView. then I have to show the message history on chat screen. Like we do for single user chat. I am stuck at this. Please suggest me how can I save and retrieve data from core data . – Sushil Sharma May 06 '15 at 04:06