In my case I need to use both answers and define self like
@interface XMPPDelegate : NSObject <XMPPMUCDelegate>
Activating XMPPMUC protocol as below:
XMPPMUC * xmppMUC = [[XMPPMUC alloc]
initWithDispatchQueue:dispatch_get_main_queue()];
[xmppMUC activate:_xmppStream];
[xmppMUC addDelegate:self delegateQueue:dispatch_get_main_queue()];
Receive join message:
- (void)xmppMUC:(XMPPMUC *)sender roomJID:(XMPPJID *) roomJID didReceiveInvitation:(XMPPMessage *)message
{
DDLogDebug(@"%@", message);
XMPPRoomMemoryStorage *roomMemoryStorage = [[XMPPRoomMemoryStorage alloc] init];
XMPPRoom *xmppRoom = [[XMPPRoom alloc] initWithRoomStorage:roomMemoryStorage jid:roomJID dispatchQueue:dispatch_get_main_queue()];
[xmppRoom activate:xmppStream];
[xmppRoom addDelegate:self delegateQueue:dispatch_get_main_queue()];
[xmppRoom joinRoomUsingNickname: xmppStream.myJID.user history:nil password:password];
XMPPPresence *presence = [XMPPPresence presence];
[[self xmppStream] sendElement:presence];
[xmppRoster addUser:roomJID withNickname:roomJID.full];
[self goOnline];
}