Packet inteceptor - how to signal rejection to senders

Hi developers,

In my PacketInteceptor impl I throw PacketRejectedException. Most clients do not signal that anything happened, so in effect its a silent rejection. I would like to notify the sender (in the same converation window/room window) that his message was not sent and to provide some information.

Whats the best way to do this or is it possible?

Also is there a difference between one 2 one conversations and group chat handling?

Thanks,

Conor.

Hey Conor,

Currently the server is returning a new Message of type ERROR to the sender of the rejected message. I filled this issue JM-313 for your enhancement request. So the idea would be to include “recovery” information in PacketRejectedException that will be used by SocketReader when building the response due to the rejection.

Let me know if you are ok with this idea.

Regards,

– Gato

Hey Gato,

If it results in the sender seeing some rejection message in his chat window, thats exactly what I was looking for.

Cheers,

Conor.

Yep. That would be the result. I will try to make the modification today so you can use the next nightly build. Will update this thread when the enhancement is available.

Regards,

– Gato

Hey Conor,

The enhancement is now in CVS so you can use the next nightly build. So if you now set the rejection message (#setRejectionMessage(String)) to the PacketRejectedException being thrown then the server will send a notification message to the sender of the reject packet.

In summary, if the rejected packet is an IQ or a Presence then the user will get an IQ/Presence of type error and may also get a notification message depending if you set the rejection message to the exception. But if the rejected packet is of type Message then no message will be sent back unless you specify a rejection message in the thrown exception.

Let me know how it goes.

Regards,

– Gato

Gato,

Using CVS directly I picked up your changes, and it worked as expected.

Attached the latest version of the plugin - note it only works with next nightly build.

there are a number of options now available including

  1. regular expressions to filter content

  2. optional content mask to alter content

  3. optional violation notification - sends a message to a specified user

  4. optional flag to silently reject message (default to send a warning message to sender, this option is only available if there is no content mask).

The readme.html explains how to the various system properties. Next up, a nice UI!
contentfilter.jar (7419 Bytes)

yes, GUI is needed

and what about property’‘s value size? Is it limited in JM? I’'m curious how much characters can i enter while composing my regular expression?

Wroot,

The limit of a property value is determined by the type of field in the database. Currently we are using a 4000 characters limit so that should be enough. Let me know if you are planning to store a bigger value.

Saludos,

– Gato

hehe, i think this will do

we are not planing using content filter yet, and if we do, 4000 chars will be enough i think

Conor,

We’‘d love to put this on the plugins page once you’'re able to add a GUI.

Thanks,

-Matt