How to reject a packet when doing a packetInterceptor

Hi guys,

Now I want to limit the user who is in my openfire server could only send message to his/her friend in the roster list. But I have no idea of how to do that.

Should I implement a new plugin for that ? or may I can do somesmall modifications in some source code ? For example, the messageRoute, packetFilter ?

If I add a packetInterceptor in my new plugin to preprocess the message packet, when I want to reject a packet that does not comply with my rules, what should I do ?

Any suggestion would be useful, thank you.