We have developed some custom functionality. I need to be able to inform the client if the custom features are enabled or not. The approach we are investigating is to add information to the result of a disco#info query.
I’‘d like to be able to add another to the reply packet. I’'ve tried to write a plugin by using the source available in the Search plugin. My first attempt looked like this:
IQ replyPacket = IQ.createResultIQ(packet); Element responseElement = DocumentHelper.createElement(QName.get("query", "http://jabber.org/protocol/disco#info")); responseElement.addElement("feature").addAttribute("var", "some:feature:name"); replyPacket.setChildElement(responseElement); componentManager.sendPacket(this, replyPacket);
This, of course, resulted in a packet being returned that only contains my feature. After looking at the Javadoc for IQ.createResultIQ(), I understand why this happens.
So, I tried this next:
Element child = packet.getChildElement(); child.addElement("feature").addAttribute("var", "some:feature:name"); componentManager.sendPacket(this, packet);
This code never returns a result from the server, and my client gets disconnected.
Can anybody help? It seems that what I’‘m trying to do shouldn’‘t be that difficult, but I’'m obviously missing something.