I have written a simple packet interceptor plugin designed to scan and reject messages with disallowed content. The disallowed content are defined using regular expressions.
I was hoping to get some feedback in order to develop the idea a bit more and maybe some people would like to give it go.
Current function is
scan packet and reject if there is a content match
Future functions could be
inform sender that the message was not sent as content was disallowed
add a switch to allow message but mask the disallowed content i.e. change content
allow rooms to have content filters , this would be useful in public room environment
sounds exciting I can do some testing, though i have some problems with new plugins now. They just dont work at all. Do i need to use latest nightly build? Or 2.1.5 version will do? It’'s just a working deployment so i dont want to broke it or somethng.
Matt can give you a permission to attach files and i think he’'ll eventually do this when read this thread. But you can send him a PM to insure that he knows
Attached is deployable plugin jar which works with Jive Messenger 2.1.5 out of the box.
There is a readme.html that describes the system properties you can use to configure the plugin which can be read when the plugin jar is expanded.
Briefly:
I have tested with “plugin.contentfilter.disallowedcontent” with value “fox,dog” and it rejects messages with subject or body containing the match, although more substantial reg exprs can be used
adding the option property “plugin.contentfilter.contentmask” with value “content removed” allows messages through but replaces any disllowedcontent matches with the mask.
How can I notify the sender of a message that a message was rejected in my PacketInteceptor implementation?
At the moment any rejected messages are silently swallowed by JM, so the sender has no way of knowing that the message was rejected. Ideally I would like the message to appear on the chat window e.g ** Message rejected
This is my current implemenation below , I would have expected the PacketRejectedException to show something on the users chat window. Perhaps I don’'t fully understand the various parameters of this interface.
As about message for the sender. Well, it actually shows blank broadcast message window with possible receiver’'s JID in From field and with yellow error icon. Doesnt look pretty. Maybe it could “say” something like “Your message was rejected bla bla”. Or better, i can think of this warning message by myself. Of course some warning message exactly in chat window would be perfect.
You are planing to create GUI for this plugin, arent you? Would be more convinient to customize it.
Content mask works perfectly (and this bolding of mask is a good idea). Havent tested it fully though. Interesting, is it masking only full matches of entered values? And what if restricted word is a part of other word (ex: foxy). Maybe it should mask it as ***beep***y? Or it could ignore some separators between letters, such as spaces, “_” and so on. All this could be selectable and customizable via GUI. Ok, i’‘m asking too much. Well, i’‘m not really asking. Just thinking of capabilities. I’‘m not sure if we need such plugin at our deployment, but it’'s really interesting thing though