How to get DiscussionHistory for MultiUserChat room using aSmack?

回眸只為那壹抹淺笑 提交于 2019-12-21 02:03:26

问题


How to get the DiscussionHistory of a MUC room from MultiUserChat? I am able to create MultiUserChat instance and room by using aSmack library, now I want to show all the previous conversations that happened in the room.

Anybody experienced in the same please help me. I Google searched a lot about this but still I did't get any proper documentation / explanation on this.


回答1:


DiscussionHistory history = new DiscussionHistory();
history.setSince(date);

muc.join(nickname, null, history, SmackConfiguration.getReplyTimeout());

// Get historical message;
Message oldMsg = muc.nextMessage(timeout);

You can also use

history.setMaxChars()
history.setMaxStanzas()
history.setSeconds()

Some examples are in the test code. Check the test testDiscussionHistory.

http://fisheye.igniterealtime.org/browse/smack/trunk/test/org/jivesoftware/smackx/muc/MultiUserChatTest.java?hb=true



来源:https://stackoverflow.com/questions/15831855/how-to-get-discussionhistory-for-multiuserchat-room-using-asmack

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!