Commit 93349560 authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gaston

Code cleanup and concurrency fix.


git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@684 b35dd754-fafc-0310-a699-88a17e54d16e
parent 95ca5850
...@@ -14,7 +14,6 @@ package org.jivesoftware.messenger.handler; ...@@ -14,7 +14,6 @@ package org.jivesoftware.messenger.handler;
import org.jivesoftware.messenger.disco.ServerFeaturesProvider; 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.admin.AdminConsole; import org.jivesoftware.admin.AdminConsole;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -34,7 +33,6 @@ import org.xmpp.packet.IQ; ...@@ -34,7 +33,6 @@ import org.xmpp.packet.IQ;
public class IQVersionHandler extends IQHandler implements ServerFeaturesProvider { public class IQVersionHandler extends IQHandler implements ServerFeaturesProvider {
private static Element bodyElement; private static Element bodyElement;
private static Element versionElement;
private IQHandlerInfo info; private IQHandlerInfo info;
public IQVersionHandler() { public IQVersionHandler() {
...@@ -44,25 +42,20 @@ public class IQVersionHandler extends IQHandler implements ServerFeaturesProvide ...@@ -44,25 +42,20 @@ public class IQVersionHandler extends IQHandler implements ServerFeaturesProvide
bodyElement = DocumentHelper.createElement(QName.get("query", "jabber:iq:version")); bodyElement = DocumentHelper.createElement(QName.get("query", "jabber:iq:version"));
bodyElement.addElement("name").setText(AdminConsole.getAppName()); bodyElement.addElement("name").setText(AdminConsole.getAppName());
bodyElement.addElement("os").setText("Java 5"); bodyElement.addElement("os").setText("Java 5");
versionElement = bodyElement.addElement("version"); bodyElement.addElement("version");
} }
} }
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
bodyElement.element("name").setText(AdminConsole.getAppName()); Element answerElement = bodyElement.createCopy();
versionElement.setText(AdminConsole.getVersionString()); answerElement.element("name").setText(AdminConsole.getAppName());
IQ result = null; answerElement.element("version").setText(AdminConsole.getVersionString());
result = IQ.createResultIQ(packet); IQ result = IQ.createResultIQ(packet);
bodyElement.setParent(null); result.setChildElement(answerElement);
result.setChildElement(bodyElement.createCopy());
return result; return result;
} }
public void initialize(XMPPServer server) {
super.initialize(server);
}
public IQHandlerInfo getInfo() { public IQHandlerInfo getInfo() {
return info; return info;
} }
......
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