如何使用aSmack获取MultiUserChat房间的DiscussionHistory?

Raj*_*ddy 5 android xmpp smack asmack

如何从MUC房间获取DiscussionHistoryMultiUserChat?我可以使用一个Smack库创建MultiUserChat实例和房间,现在我想显示房间里发生的所有先前的对话.

有同样经验的人请帮助我.谷歌搜索了很多关于这一点,但我仍然没有得到任何适当的文件/解释.

Rob*_*bin 14

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

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

// Get historical message;
Message oldMsg = muc.nextMessage(timeout);
Run Code Online (Sandbox Code Playgroud)

你也可以使用

history.setMaxChars()
history.setMaxStanzas()
history.setSeconds()
Run Code Online (Sandbox Code Playgroud)

一些例子在测试代码中.检查测试testDiscussionHistory.

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