0

I've configured Conversejs to Auto join a room, with a preconfigured account and credentials. I would like it to clear the previous messages when the room is joined.

I've been able to put together this shell of a plugin, and have confirmed it executes but dont know the code to clear the chat text.

converse.plugins.add('myplugin', { 
        initialize: function () { 
            this._converse.api.listen.on('roomsAutoJoined', () => { 
                // How to clear chat ??
            });            
        } 
    });

Basicically executing the /clear command for the user automatically when joining room. There will always be another user signed into the room, or else I know it would clear automatically. Also I'm using ejabberd if it matters.

1 Answers1

0

You can set clear_muc_messages_on_reconnection to true.

JC Brand
  • 2,652
  • 18
  • 18
  • Thank you very much for the great software!I'm aware of that option, however I'm trying to do this via a function and need a little bit more hand holding :) I did end up adding _converse = this._converse; inside my initialize to get some things working like a timed log out feature. I was reviewing the "headless" docs to see how that function you mentioned worked, but couldnt reproduce it in my own function. – Derek Hinga Dec 08 '19 at 12:19
  • Why do you want to do this with a function? AFAIK the option I mention does what you ask for. – JC Brand Dec 10 '19 at 11:01