【发布时间】:2013-04-05 10:42:44
【问题描述】:
如何从MultiUserChat 获取MUC 房间的讨论历史?我可以使用 aSmack 库创建 MultiUserChat 实例和房间,现在我想显示房间中发生的所有先前对话。
任何有相同经验的人请帮助我。我在 Google 上搜索了很多关于此的内容,但我仍然没有得到任何适当的文档/解释。
【问题讨论】:
如何从MultiUserChat 获取MUC 房间的讨论历史?我可以使用 aSmack 库创建 MultiUserChat 实例和房间,现在我想显示房间中发生的所有先前对话。
任何有相同经验的人请帮助我。我在 Google 上搜索了很多关于此的内容,但我仍然没有得到任何适当的文档/解释。
【问题讨论】:
DiscussionHistory history = new DiscussionHistory();
history.setSince(date);
muc.join(nickname, null, history, SmackConfiguration.getReplyTimeout());
// Get historical message;
Message oldMsg = muc.nextMessage(timeout);
你也可以使用
history.setMaxChars()
history.setMaxStanzas()
history.setSeconds()
一些示例在测试代码中。检查测试testDiscussionHistory。
【讨论】:
history.setMaxStanzas(20)。我想从这段历史中获得最后 20 条消息。请帮助我。
Message oldMsg = muc.nextMessage(timeout); 如何避免即使用户随时进入不同的房间..还有 timeout 这里的最佳价值是什么跨度>