Hi,
Thanks for your answer… I have start to write the plug in, but have some problems to continue…
I have add an IqHandler but :
1 - I need to filter the IQ packet by namespace. But how ?
2 - How can I know the IP of the socket that receive this IQ message ?
3 - I want to send back the IQ message to the sender. But how ?
Please, can you advice ?
Here is my current code :
package com.ufoz
import org.jivesoftware.wildfire.container.Plugin;
import org.jivesoftware.wildfire.container.PluginManager;
import java.io.File;
/**
-
This plug in allow to send back the external IP.
-
When we send a message behind a router/firewall, we only know our “internal ip” (192…)
-
But with this plug in, we can discover our IP as seen by external softwares.
*/
public class ExternalIPPlugin implements Plugin
{
public void initializePlugin(PluginManager manager, File pluginDirectory)
{
IQHandler iqHandler = new ExternalIPIQHandler();
IQRouter iqRouter = XMPPServer.getInstance().getIQRouter();
iqRouter.addHandler( iqHandler );
}
public void destroyPlugin()
{
IQRouter iqRouter = XMPPServer.getInstance().getIQRouter();
iqRouter.removeHandler( iqHandler );
}
}
public class ExternalIPIQHandler implements IQHandler
{
public IQ handleIQ(IQ packet) throws UnauthorizedException
{
//---- 1. Get the IP that produce this IQ packet
//---- 2. Send back an IQ packet that contains this IP
}
}