Stope Retreiving all chat histories when rejoin group

I’m using Smack v4.3.0 for Android. The issue is, when a user rejoins a group, all the chat histories are being delivered. Want to know how to disable this. I’m using the following code snippet for joining the group.

MultiUserChat multiUserChat=multiUserChatManager.getMultiUserChat(JidCreate.entityBareFrom("man@conference.localhost"));
        multiUserChat.getEnterConfigurationBuilder(Resourcepart.from("sport")).requestNoHistory().build();

but it doesn’t work
please any help

Your code doesn’t make sense, since you don’t use the result of the builder anywhere. Try this:

MultiUserChat chat = getMultiUserChat(mucJid);
MucEnterConfiguration enterConfig = chat.getEnterConfigurationBuilder(nickname)
                                 .requestNoHistory()
                                 .build();
chat.join(enterConfig);
1 Like

thanks that solved my problem , i appreciate your help

I am following your code. But still I am not getting any messages of group. There are already many messages in it but still returning 0. Below is code for that:

private fun initGroupChatRoom(){
        val mucEnterConfiguration = multiUserChat?.getEnterConfigurationBuilder(nickname)!!
            .requestNoHistory()
            .build()

        if (!multiUserChat!!.isJoined) {
            multiUserChat?.join(mucEnterConfiguration)
        }
        multiUserChat?.addMessageListener(incomingMessageListener)
    }

private fun chatHistory(){
        CoroutineScope(Dispatchers.IO).launch {
            var mamManager = MamManager.getInstanceFor(multiUserChat)

            var result =  async {
                mamManager.enableMamForAllMessages()
                mamManager.queryMostRecentPage(jId, 70)
            }.await()
      }
    }


Here, the result is an empty return.

I solved using the latest library version 4.4.0.beta01

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.