powered by Jive Software

Simple Bandersnatch-like plugin

As I have spent too much time to get Bandersnatch Jabber recorder to work with Wildfire, I have decided to write a simple plugin that will record packets to the database. Here’‘s my question: in the plugin I’‘m implementing PacketInterceptor interface’'s interceptPacket() method:

void interceptPacket(Packet packet,

Session session,

boolean incoming,

boolean processed)

throws PacketRejectedException

I have problems with understanding what exactly ‘‘incoming’’ and ‘‘processed’’ flags mean. Right now I don’'t check them at all and far too many packets are being saved.

What is the best way to make sure that the plugin will receive only/b what is being sent to and receive from the clients?


Hey coquelicot,

The server receives packets from clients and after processing the packet a new packet is going to be sent to the initial sender or any other XMPP entity. After having said that, the incoming[/i] parameter will be true when the server is receiving a packet and false when it is sending a packet to an XMPP entity. On the other hand, the processed[/i] parameter will be false when the server has not yet processed the packet and will be true after it processed the packet.

Since you are not interested in rejecting packets I would recommend using a filter where your interceptor will only process already processed packets (i.e. processed = true). Filtering by the incoming parameter really depends on your needs.


– Gato