Is there a way to skip specific packets in a plugin?

Igor Khomenko
Added over 1 year ago

Is there a way to skip specific packets in a plugin?

For example, in MessageAmp plugin we have the following code:

private static final String[][] ELEMENTS = {
    { "message" }, { "presence" }, { "iq", "msgoffline" }

public String[][] supElementNamePaths() {
  return ELEMENTS;

which tells to process all message packets, all presence packets, and all iq packets with msgoffline subchild.

But what if I want to skip messages with some subchild.

For example, I try to build 'self-destroy' functionality, like in Telegram messenger

Here is my packet format:

<message id="test" to="" type="chat">
  <body>hello world</body> 
  <destroy after="5" xmlns='urn:xmpp:message-destroy-after:0'/>

What I want is NOT to store this message to offline storage for example, but MessageAmp plugin will do this.

It will be great if we will be able to set up something like this:

private static final String[][] ELEMENTS_TO_SKIP = {
    { "message", "destroy" }

Is this possible?

Replies (1)

Added by Wojciech Kapcia TigaseTeam over 1 year ago

Currently it's not possible - the only way is to check each packet for the elements and skip them accordingly. Feel free to submit a feature request so we can plan implementing this.