Commit c2d21549 authored by Matt Tucker's avatar Matt Tucker Committed by matt

Version will now obey info set by plugins.


git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@664 b35dd754-fafc-0310-a699-88a17e54d16e
parent 366ae7bd
...@@ -15,6 +15,8 @@ import org.jivesoftware.messenger.disco.ServerFeaturesProvider; ...@@ -15,6 +15,8 @@ import org.jivesoftware.messenger.disco.ServerFeaturesProvider;
import org.jivesoftware.messenger.IQHandlerInfo; import org.jivesoftware.messenger.IQHandlerInfo;
import org.jivesoftware.messenger.PacketException; import org.jivesoftware.messenger.PacketException;
import org.jivesoftware.messenger.XMPPServer; import org.jivesoftware.messenger.XMPPServer;
import org.jivesoftware.admin.AdminConsole;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
import org.dom4j.DocumentHelper; import org.dom4j.DocumentHelper;
...@@ -24,22 +26,8 @@ import org.xmpp.packet.IQ; ...@@ -24,22 +26,8 @@ import org.xmpp.packet.IQ;
/** /**
* Implements the TYPE_IQ jabber:iq:version protocol (version info). Allows * Implements the TYPE_IQ jabber:iq:version protocol (version info). Allows
* Jabber entities to query each other's application versions. The server * XMPP entities to query each other's application versions. The server
* will respond with its current version info. * will respond with its current version info.
* <p/>
* <h2>Assumptions</h2>
* This handler assumes that the request is addressed to itself.
* An appropriate TYPE_IQ tag matcher should be placed in front of this
* one to route TYPE_IQ requests not addressed to the server to
* another channel (probably for direct delivery to the recipient).
* <p/>
* <h2>Warning</h2>
* There should be a way of determining whether a session has
* authorization to access this feature. I'm not sure it is a good
* idea to do authorization in each handler. It would be nice if
* the framework could assert authorization policies across channels.
*
* <p>TODO: Verify responding to an iq 'get'</p>
* *
* @author Iain Shigeoka * @author Iain Shigeoka
*/ */
...@@ -55,7 +43,7 @@ public class IQVersionHandler extends IQHandler implements ServerFeaturesProvide ...@@ -55,7 +43,7 @@ public class IQVersionHandler extends IQHandler implements ServerFeaturesProvide
info = new IQHandlerInfo("query", "jabber:iq:version"); info = new IQHandlerInfo("query", "jabber:iq:version");
if (bodyElement == null) { if (bodyElement == null) {
bodyElement = DocumentHelper.createElement(QName.get("query", "jabber:iq:version")); bodyElement = DocumentHelper.createElement(QName.get("query", "jabber:iq:version"));
bodyElement.addElement("name").setText("Jive Messenger"); bodyElement.addElement("name").setText(AdminConsole.getAppName());
bodyElement.addElement("os").setText("Java 5"); bodyElement.addElement("os").setText("Java 5");
versionElement = bodyElement.addElement("version"); versionElement = bodyElement.addElement("version");
} }
...@@ -63,7 +51,8 @@ public class IQVersionHandler extends IQHandler implements ServerFeaturesProvide ...@@ -63,7 +51,8 @@ public class IQVersionHandler extends IQHandler implements ServerFeaturesProvide
public IQ handleIQ(IQ packet) throws PacketException { public IQ handleIQ(IQ packet) throws PacketException {
// Could cache this information for every server we see // Could cache this information for every server we see
versionElement.setText(localServer.getServerInfo().getVersion().getVersionString()); bodyElement.element("name").setText(AdminConsole.getAppName());
versionElement.setText(AdminConsole.getVersionString());
IQ result = null; IQ result = null;
result = IQ.createResultIQ(packet); result = IQ.createResultIQ(packet);
bodyElement.setParent(null); bodyElement.setParent(null);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment