I want to rejoin room and don’t want any history, but DiscussionHistory is deprecated. So I found class MucEnterConfiguration.
But I am unable to create object of MucEnterConfiguration.
MucEnterConfiguration is a final class so it can’t be extends and
don’t have a public constructor.
MucEnterConfiguration.Builder is also final class so it can’t be
extends and don’t have a public constructor.
How I can create object of it.
Thanks
EntityBareJid mucJid = JidCreate.entityBareFrom(roomJid);
Resourcepart nickname = Resourcepart.from(nickname);
MultiUserChatManager manager = MultiUserChatManager.getInstanceFor(connection);
MultiUserChat muc = manager.getMultiUserChat(mucJid);
MucEnterConfiguration.Builder mec = muc.getEnterConfigurationBuilder(nickname);
String lastDate = "yourLastDate";
if(lastDate!=null)
{
try {
Date date = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").parse(lastDate);
int secondsBetween = (int) ((new Date().getTime() - date.getTime()) / 1000);
mec.requestHistorySince(secondsBetween - 1);
} catch (Exception e) {
mec.requestNoHistory();
}
} else {
mec.requestNoHistory();
}
MucEnterConfiguration mucEnterConfig = mec.build();
muc.join(mucEnterConfig);