2

I am always receiving group chat history while joining the room. To be more specific, whenever I join a group, I am receiving the last one message(only one message) which I have sent to that group. I have tried the following methods to disable this..

  • As per the documentation suggests, I have passed the value 'maxchars='0'' with the history parameter of initial presence while joining the room.
  • At the web admin page go to Group Chat section, then Group Chat Settings -> Group Chat Service Properties -> History Settings -> Don't show History

Eventhough I have tried all these possible ways, am still receiving a history message while joining the room. please note that the message which I am receiving at the time of joining, contains delay extension. if it matters.

Saamzzz
  • 206
  • 1
  • 14
  • 2
    What implementation is the MUC service running? – legoscia Dec 15 '14 at 16:50
  • We are using Openfire as XMPP server.Currently we haven't installed a MUC plugin with openfire. Will that be a problem?. But we can still add new service from, Group Chat -> Group Chat Settings -> Crete New Service. Also we are able to create new groups in that service. – Saamzzz Dec 16 '14 at 08:05
  • This question seems similar to [this question](http://stackoverflow.com/questions/22496868/is-there-any-option-to-disable-group-chat-message-history-on-open-fire-server), though I don't think it's a duplicate. It's weird that Openfire wouldn't respect the `maxchars` attribute... – legoscia Dec 16 '14 at 10:50
  • 1
    I have implemented the methods which are given as solutions there. But still why its happening?. Is it a bug in my android client(SMACK) library. – Saamzzz Dec 16 '14 at 12:06
  • @Saamzzz Have you got any solution / workaround for this problem? I'm facing this issue currently and the below solutions don't work for me. – gopalanrc Jul 22 '20 at 12:04

1 Answers1

8

Try this..

    MultiUserChat muc = new MultiUserChat(mConnection, room_name);
    Log.d(TAG, "JOINING => " + room_name);

    DiscussionHistory history = new DiscussionHistory();
    history.setMaxStanzas(0);

     muc.join(mNickName, null, history,SmackConfiguration.getDefaultPacketReplyTimeout());

And if get "group is asynchronous" this msg, then its just like notification that you join group. just put if condition for this in groupchat listener.

Lokesh
  • 2,917
  • 2
  • 29
  • 54
  • But why it return the history while joining or rejoining the room/group? Can't we disable? – RobinHood Jun 17 '15 at 07:03
  • yes, we can disable history form both side server as well as device side, above code disable history from device side. – Lokesh Jun 17 '15 at 07:09
  • and we alway getting "group is asynchronous" notification when we join or rejoin group – Lokesh Jun 17 '15 at 07:10
  • It doesn't work in my case. Still, the old messages are delivered when a user rejoins. Please advice.. – gopalanrc Jul 22 '20 at 10:59