I made a plugin that uses the InterceptorManager to catch every packet send and do some work with them.
Am I ok to assume that every packet received by openfire will go through the plugin.
The plugin’s code is as follows. Could someone confirm that every packet received by openfire would go through this plugin? Or is it possible that an error at some point could stop the packet from getting here?
public class MyPlugin implements PacketInterceptor, Plugin { private InterceptorManager interceptorManager; public MsgLoggerPlugin() {
interceptorManager = InterceptorManager.getInstance();
} @Override
public void initializePlugin(PluginManager manager, File pluginDirectory) {
// register the interceptor
interceptorManager.addInterceptor(this);
}
@Override
public void destroyPlugin() {
// unregister the interceptor
interceptorManager.removeInterceptor(this);
}
@Override
public void interceptPacket(Packet packet, Session session, boolean incoming, boolean processed)
throws PacketRejectedException {
if (!processed) {
// process packet
}
}
}