I am writing a plugin as an IQhandler.
any examples or links of plugins registered as IQhandler?
My plugin has to receive IQ packets with a particular namespace, then it has to process it, and then it has to send back an IQ response.Suggestions?
thanks in advance
Hi,
You shouldn’t write plugin as IQHandler. Instead, you must implement Plugin and then regsiter your custom IQHandler like this:
public class MyPlugin implements Plugin {
IQHandler iqHandler = null;
@Override
public void initializePlugin(PluginManager manager, File pluginDirectory) {
iqHandler = new MyIQHandler(“My IQ handler”);
IQRouter iqRouter = XMPPServer.getInstance().getIQRouter();
iqRouter.addHandler(iqHandler);
}
}
Don’t forget to unregister your IQHandler on plugin destroy. Basically, the openfire plugins’ source code is a good place to start.
Vlad.