XMPP - How do I delete all messages between two jids, but only for one user?

299 Views Asked by At

Problem: I want to delete all the messages (and thread) from one side of an equation between two users, A and B. I have no idea if this is even possible and if so, how.

I have the:

  • jid of each user
  • an XMPP library in JS (custom) that allows me to send IQ or any other type of stanza.

For example, this is how I get my friends (roster) list:

  async getFriends() {
    const requestId = this.sendStanza(
      'iq',
      { type: 'get' },
      (stanza) => stanza.c('query', { xmlns: 'jabber:iq:roster' }),
    )
    const result = await this.once('*', requestId);
    const requests = result.children[0].children.map(child => child.attrs.jid);
    return requests;
  }

Hopefully this is enough for someone to advise me. Thanks.

1

There are 1 best solutions below

0
On

If you have full access to the client logic, you can implement your own logic, for instance, you can send an IQ stanza with a specific name space (xmlns) along with some elements/attributes, when the receiving side receives that IQ, it will do whatever logic you want (delete messages, thread, etc..)

Check this out: https://xmpp.org/extensions/xep-0424.html it is an extension to delete (retract) single message.