powered by Jive Software

A problem of IQ.addExtension(),Help me,Thx!

First, I add ExtensionProvider in my plugin. The code is follow:
providerManager.addExtensionProvider("testpe", "lance:pe:test",new TestPacketExtensionProvider());

The provider is very simple,just print a String for test.

Then , I made a IQ and Message for test:

TestIQ tiq = new TestIQ();         tiq.setTo("admin@CHINA-2171AFB32/Smack");
Message msg = new Message();
     msg.setTo("admin@CHINA-2171AFB32/Smack");

and a PacketExtension:

TestPacketExtension tpe = new TestPacketExtension();

The problem is here:

If I add the tpe in to tiq,and send the tiq, my provider dosen’t print anything.the cod is follow:

tiq.addExtension(tpe);
     conn.sendPacket(tiq);

but if add the tpe in to msg,adn send the msg , my provider can work very well. the code is follow:

msg.addExtension(tpe);
     conn.sendPacket(msg);

Sorry,my english is not very well.

-------------------------------------divider --------------------------------------------

my TestIQ code:

public class TestIQ extends IQ {
private String info; public TestIQ(){
  } public String getChildElementXML() {
  StringBuilder buf = new StringBuilder();
  buf.append("<test xmlns=\"lance:iq:testiq\">");
  buf.append("<info>" + getInfo() + "</info>");
  buf.append("</test>");
  return buf.toString();
}
public String getInfo() {
  return info;
}
public void setInfo(String info) {
  this.info = info;
}
}

The IQ is a special Packet???

the IQ can’t use the method addExtension()???