如何从Openfire的群聊的离线消息离线、消息、Openfire

2023-09-06 08:00:00 作者:正在开启作死模式

XMPP任何方式,我得到的离线消息 MultiUserChat的,当我的用户登录并加入房间。

Is any way in xmpp that i get offline message of MultiUserChat, when my user login and join room.

我想实现的群聊如的WhatsApp ,是实施此项请建议任何其他方式

I want implement group chat like WhatsApp, Is any other way to implement this please suggest

在此先感谢

推荐答案

至少,当你进入了聊天群,你必须输入你的最后一个时间戳,鉴于该时间戳你会从那个时候起接收的消息。

At least in ejjaberd when you enter the chat group, you have to enter your last timestamp, given that timestamp you will receive the messages from that moment.

从你的最后一条消息保存时间戳记,并且当你进入你的房间,如下所示:

Save the timestamp from your last message, and when you enter to your room, like the following:

 MultiUserChat muc = new MultiUserChat(mConnection, room_name);
                Log.d(TAG, "JOINING => " + room_name);

                DiscussionHistory history = new DiscussionHistory();
                if (mLastMessageDate == null)
                    history.setMaxStanzas(300);
                else
                    history.setSince(mLastMessageDate); //timestamp from your last message

 muc.join(mNickName, null, history,
                            SmackConfiguration.getDefaultPacketReplyTimeout());

希望它能帮助