How to get discussion history for MultiUserChat room using aSmack?

How to get a MUC room discussion history from MultiUserChat? I can create an instance and a MultiUserChat room using the aSmack library, now I want to show all the previous conversations that took place in the room.

Anyone who has experienced this, please help me. I searched a lot about this on Google, but so far I have not had proper documentation / explanations.

+5
source share
1 answer
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 given in the test code. Check out the test test of DiscussionHistory.

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

+14

All Articles