objective c - How to add buddy/user in group in xmpp iphone? -
i have wrote code creating room. using had created room in openfire.
-(void)creategroup:(nsstring*)groupname { xmpproomcoredatastorage *rosterstorage = [[xmpproomcoredatastorage alloc] init]; xmpproom = [[xmpproom alloc] initwithroomstorage:rosterstorage jid:[xmppjid jidwithstring:[nsstring stringwithformat:@"%@@conference.%@/%@",groupname,@"server",self.strusername]] dispatchqueue:dispatch_get_main_queue()]; [xmpproom activate:[self xmppstream]]; [xmpproom joinroomusingnickname:@"nickname" history:nil]; [xmpproom adddelegate:self delegatequeue:dispatch_get_main_queue()]; [self performselector:@selector(configurenewroom) withobject:nil afterdelay:5]; } -(void)configurenewroom { [xmpproom fetchconfigurationform]; [xmpproom configureroomusingoptions:nil]; } now want add buddy/users in group. how can ? in advance.
// using done
xmpproommemorystorage *roommemorystorage = [[xmpproommemorystorage alloc] init]; nsstring *strjid = [nsstring stringwithformat:@"%@@conference.%@/%@",groupname,strhostname,self.strusername]; self.xmpproom = [[xmpproom alloc] initwithroomstorage:roommemorystorage jid:[xmppjid jidwithstring:strjid] dispatchqueue:dispatch_get_main_queue()]; [self.xmpproom adddelegate:self delegatequeue:dispatch_get_main_queue()]; [self.xmpproom activate:self.xmppstream]; [self.xmpproom joinroomusingnickname:self.strusername history:nil]; //inviting nsstring *strinvitedusername = [nsstring stringwithformat:@"%@@%@",personname,strhostname]; [self.xmpproom inviteuser:[xmppjid jidwithstring:strinvitedusername] withmessage:message];
Comments
Post a Comment