How to get DiscussionHistory for MultiUserChat room using aSmack?

前端 未结 1 1552
予麋鹿
予麋鹿 2021-02-10 05: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

1条回答
  •  南笙
    南笙 (楼主)
    2021-02-10 05:32

    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

    0 讨论(0)
提交回复
热议问题