I am interested in write a plugin which could handle my IQ messages.
I see the code to Register a plugin as an IQHandler in the link
http://www.jivesoftware.org/builds/wildfire/docs/latest/documentation/plugin-dev -guide.html
IQHandler myHandler = new MyIQHander();
IQRouter iqRouter = XMPPServer.getInstance().getIQRouter();
iqRouter.addHandler(myHandler);[/code]
Where do you I need to add this code in the plugin? Or have to write a separate IQHandler? Can someone point me to an example for this?
My IQHandler class looks something like this:
This is good to use as an IQHandler plugin or am I missing something?
package org.jivesoftware.wildfire.plugin;
import java.io.File;
import org.dom4j.Element;
import org.indent.wildfire.auth.UserRandomList;
import org.jivesoftware.wildfire.ClientSession;
import org.jivesoftware.wildfire.SessionManager;
import org.jivesoftware.wildfire.XMPPServer;
import org.jivesoftware.wildfire.container.Plugin;
import org.jivesoftware.wildfire.container.PluginManager;
import org.xmpp.packet.IQ;
import org.xmpp.packet.JID;
import org.xmpp.packet.Packet;
import org.indent.wildfire.auth.ClientIDExtension;
import org.jivesoftware.wildfire.Session;
public class ClientRandomPlugin implements Plugin {
private XMPPServer server;
private UserManager userManager;
private PluginManager pluginManager;
private String serviceName;
private static String serverName;
public ClientRandomPlugin() {
}
public void initializePlugin(PluginManager manager, File pluginDirectory) {
pluginManager = manager;
}
public void initialize(JID jid, ComponentManager componentManager) {
}
public void start() {
}
public void destroyPlugin() {
pluginManager = null;
server = null;
userManager = null;
}
public void shutdown() {
}
public void processPacket(Packet p) {
}
private IQ handleIQ(IQ packet) {
}
}[/code]