I\'m a newbie to XMPP so forgive me if this question sounds silly. I want to create a custom plugin and map it with my aSmack client on Android. I\'m trying to apply my kno
There is a simple instance about plugin:
public class TestIQHandle extends IQHandler {
private static final String MODULE_NAME = "test plugin";
private static final String NAME_SPACE = "com:test:testplug";
private IQHandlerInfo info;
public TestIQHandle(){
super(MODULE_NAME);
info = new IQHandlerInfo("query", NAME_SPACE);
}
public TestIQHandle(String moduleName) {
super(moduleName);
info = new IQHandlerInfo("query", NAME_SPACE);
}
@Override
public IQ handleIQ(IQ packet) throws UnauthorizedException {
IQ reply = IQ.createResultIQ(packet);
Element groups = packet.getChildElement();
if(true){
System.out.println("=======invalid========");
}
if(!IQ.Type.get.equals(packet.getType())){
reply.setChildElement(groups.createCopy());
reply.setError(PacketError.Condition.bad_request);
return reply;
}
//StringUtils.substringBefore(packet.getFrom().toString(), "@");
return reply;
}
@Override
public IQHandlerInfo getInfo() {
// TODO Auto-generated method stub
return info;
}
}