如何检索离线消息openfire XMPP?

问题描述:

我成功实现了使用Openfire和XMPP进行群聊。如何检索离线消息openfire XMPP?

现在,当用户A向离线的用户B发送消息时,所以当用户B在线时,我如何从服务器检索所有未读/离线消息。

我做这个东西加入聊天室,但它从服务器获取的所有消息:

- (void) getJoinRoom 
{ 
    XMPPRoomMemoryStorage *roomStorage = [[XMPPRoomMemoryStorage alloc] init]; 
    XMPPJID *roomJID = [XMPPJID jidWithString:chatWithUser]; 

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

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

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

如何抓那些离线消息?

根据XMPP标准,只有一对一聊天消息才有资格进行离线存储,因此type =“groupchat”的消息从不存储在XMPP服务器的离线存储中。

根据MUC XEP如果用户下线,它不再被视为房间的参与者。所以当用户上网时,他必须通过发送存在包到房间来加入房间。