Deleting messages in the Spark client automatically

Is there any way to schedule message deletion automatically on the Spark client, different from deletion on the server?

I do not think so. Spark maintains its message archive in text files in the user directory. You could probably come up with scripting that would periodically delete those, or something like that.

Would it be possible to do it through the database?

Changes to the Openfire database will not affect the messages that are stored by Spark on the local computer that is running Spark.

Would it be possible to do it through the database?

Adding to guus.

XMPP is not like cloud platforms where messages are stored on the server and served to the client, requiring a constant internet connection to simply read old messages (take Discord as an example of this behaviour).

An XMPP server is just relaying the messages from user to user (or device to device), your client is what stores all the messages, which is why if you switch client you will realise messages will not show up.

For many people this can be annoying, they move client or they add a new device and would like to see what messages they have been sending, therefore a XEP was proposed to archive the messages server side, so that clients could request missing messages they have not yet received. This is referred to as MAM (Message Archive Management) for more information see XEP-0313.

Most of the time, MAM only stores messages for a short period of time, this depends on the server provider, or if you are hosting the server yourself, whatever period you have configured your server to store messages for.

Back to your statement, clearing the messages, in other words wiping the MAM database, only removes the server side copies, which are likely purged when they expire anyways, most clients will store their own copies, and to the best of my knowledge there is currently no XEP to standardise a method of clients telling each other how long to store messages for.

Conversations (and its forks) I believe have an option to tell the client how long to store messages for, however even if you set this, messages will remain on spark or any other XMPP client you are using.

If I am bored tomorrow I might write a script to purge messages older than a specific date/time, I doubt it will be too difficult, unless someone does this before I have the chance.

I have only used spark briefly, however I have a feeling that this could also be problematic (maybe guus could give more insight on this), say we delete all messages older than 3 days, and MAM has an expire time of 7 days (which seems to be the average from what I have seen), spark is likely to see missing messages which it has not stored from MAM and could pull them back down again, gajim does exactly this, if you try to purge messages manually on gajim, it will think it simply pull them down again. Again just a speculation from experiences with other clients.

Purging messages older than the MAM expiry would work though, in theory.

Anyways I hope the longer explanation clears up the difference between local and server side storage of messages, and I also hope I haven’t made any mistakes.

@Polarian Thank you very much for the explanation, I was very helpful, if you could make this script available I would be happy to run it