Commit 3021021f authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gato

Refactoring work.

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk@6714 b35dd754-fafc-0310-a699-88a17e54d16e
parent 82bbbc3a
......@@ -18,7 +18,6 @@ import org.jivesoftware.util.JiveGlobals;
import org.jivesoftware.wildfire.IQHandlerInfo;
import org.jivesoftware.wildfire.SessionManager;
import org.jivesoftware.wildfire.XMPPServer;
import org.jivesoftware.wildfire.auth.UnauthorizedException;
import org.jivesoftware.wildfire.forms.spi.XDataFormImpl;
import org.jivesoftware.wildfire.handler.IQHandler;
import org.jivesoftware.wildfire.user.UserManager;
......@@ -84,7 +83,7 @@ public class IQDiscoInfoHandler extends IQHandler {
return info;
}
public IQ handleIQ(IQ packet) throws UnauthorizedException {
public IQ handleIQ(IQ packet) {
// Create a copy of the sent pack that will be used as the reply
// we only need to add the requested info to the reply if any otherwise add
// a not found error
......
......@@ -17,7 +17,6 @@ import org.dom4j.QName;
import org.jivesoftware.wildfire.IQHandlerInfo;
import org.jivesoftware.wildfire.SessionManager;
import org.jivesoftware.wildfire.XMPPServer;
import org.jivesoftware.wildfire.auth.UnauthorizedException;
import org.jivesoftware.wildfire.handler.IQHandler;
import org.jivesoftware.wildfire.roster.RosterItem;
import org.jivesoftware.wildfire.session.Session;
......@@ -71,9 +70,7 @@ public class IQDiscoItemsHandler extends IQHandler implements ServerFeaturesProv
return info;
}
public IQ handleIQ(IQ packet) throws UnauthorizedException {
// TODO Let configure an authorization policy (ACL?). Currently anyone can discover items.
public IQ handleIQ(IQ packet) {
// Create a copy of the sent pack that will be used as the reply
// we only need to add the requested items to the reply if any otherwise add
// a not found error
......
......@@ -18,10 +18,13 @@ import org.jivesoftware.util.Log;
import org.jivesoftware.util.PropertyEventDispatcher;
import org.jivesoftware.util.PropertyEventListener;
import org.jivesoftware.wildfire.*;
import org.jivesoftware.wildfire.filetransfer.FileTransferManager;
import org.jivesoftware.wildfire.auth.UnauthorizedException;
import org.jivesoftware.wildfire.container.BasicModule;
import org.jivesoftware.wildfire.disco.*;
import org.jivesoftware.wildfire.disco.DiscoInfoProvider;
import org.jivesoftware.wildfire.disco.DiscoItemsProvider;
import org.jivesoftware.wildfire.disco.DiscoServerItem;
import org.jivesoftware.wildfire.disco.ServerItemsProvider;
import org.jivesoftware.wildfire.filetransfer.FileTransferManager;
import org.jivesoftware.wildfire.forms.spi.XDataFormImpl;
import org.xmpp.packet.IQ;
import org.xmpp.packet.JID;
......@@ -95,25 +98,15 @@ public class FileTransferProxy extends BasicModule
}
if ("http://jabber.org/protocol/disco#info".equals(namespace)) {
try {
IQ reply = XMPPServer.getInstance().getIQDiscoInfoHandler().handleIQ(packet);
router.route(reply);
return true;
}
catch (UnauthorizedException e) {
// Do nothing. This error should never happen
}
IQ reply = XMPPServer.getInstance().getIQDiscoInfoHandler().handleIQ(packet);
router.route(reply);
return true;
}
else if ("http://jabber.org/protocol/disco#items".equals(namespace)) {
try {
// a component
IQ reply = XMPPServer.getInstance().getIQDiscoItemsHandler().handleIQ(packet);
router.route(reply);
return true;
}
catch (UnauthorizedException e) {
// Do nothing. This error should never happen
}
// a component
IQ reply = XMPPServer.getInstance().getIQDiscoItemsHandler().handleIQ(packet);
router.route(reply);
return true;
}
else if (FileTransferManager.NAMESPACE_BYTESTREAMS.equals(namespace)) {
if (packet.getType() == IQ.Type.get) {
......
......@@ -262,26 +262,16 @@ public class MultiUserChatServerImpl extends BasicModule implements MultiUserCha
router.route(reply);
}
else if ("http://jabber.org/protocol/disco#info".equals(namespace)) {
try {
// TODO MUC should have an IQDiscoInfoHandler of its own when MUC becomes
// a component
IQ reply = XMPPServer.getInstance().getIQDiscoInfoHandler().handleIQ(iq);
router.route(reply);
}
catch (UnauthorizedException e) {
// Do nothing. This error should never happen
}
// TODO MUC should have an IQDiscoInfoHandler of its own when MUC becomes
// a component
IQ reply = XMPPServer.getInstance().getIQDiscoInfoHandler().handleIQ(iq);
router.route(reply);
}
else if ("http://jabber.org/protocol/disco#items".equals(namespace)) {
try {
// TODO MUC should have an IQDiscoItemsHandler of its own when MUC becomes
// a component
IQ reply = XMPPServer.getInstance().getIQDiscoItemsHandler().handleIQ(iq);
router.route(reply);
}
catch (UnauthorizedException e) {
// Do nothing. This error should never happen
}
// TODO MUC should have an IQDiscoItemsHandler of its own when MUC becomes
// a component
IQ reply = XMPPServer.getInstance().getIQDiscoItemsHandler().handleIQ(iq);
router.route(reply);
}
else {
return false;
......
......@@ -21,7 +21,6 @@ import org.jivesoftware.wildfire.PacketRouter;
import org.jivesoftware.wildfire.RoutableChannelHandler;
import org.jivesoftware.wildfire.RoutingTable;
import org.jivesoftware.wildfire.XMPPServer;
import org.jivesoftware.wildfire.auth.UnauthorizedException;
import org.jivesoftware.wildfire.component.InternalComponentManager;
import org.jivesoftware.wildfire.container.BasicModule;
import org.jivesoftware.wildfire.disco.DiscoInfoProvider;
......@@ -155,26 +154,16 @@ public class PubSubModule extends BasicModule implements ServerItemsProvider, Di
namespace = childElement.getNamespaceURI();
}
if ("http://jabber.org/protocol/disco#info".equals(namespace)) {
try {
// TODO PubSub should have an IQDiscoInfoHandler of its own when PubSub becomes
// a component
IQ reply = XMPPServer.getInstance().getIQDiscoInfoHandler().handleIQ(iq);
router.route(reply);
}
catch (UnauthorizedException e) {
// Do nothing. This error should never happen
}
// TODO PubSub should have an IQDiscoInfoHandler of its own when PubSub becomes
// a component
IQ reply = XMPPServer.getInstance().getIQDiscoInfoHandler().handleIQ(iq);
router.route(reply);
}
else if ("http://jabber.org/protocol/disco#items".equals(namespace)) {
try {
// TODO PubSub should have an IQDiscoItemsHandler of its own when PubSub becomes
// a component
IQ reply = XMPPServer.getInstance().getIQDiscoItemsHandler().handleIQ(iq);
router.route(reply);
}
catch (UnauthorizedException e) {
// Do nothing. This error should never happen
}
// TODO PubSub should have an IQDiscoItemsHandler of its own when PubSub becomes
// a component
IQ reply = XMPPServer.getInstance().getIQDiscoItemsHandler().handleIQ(iq);
router.route(reply);
}
else {
// Unknown namespace requested so return error to sender
......
......@@ -11,7 +11,6 @@
package org.jivesoftware.wildfire.stun;
import de.javawi.jstun.test.demo.StunServer;
import org.bouncycastle.util.Strings;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.jivesoftware.util.JiveGlobals;
......@@ -28,16 +27,12 @@ import org.xmpp.packet.IQ;
import org.xmpp.packet.JID;
import org.xmpp.packet.Packet;
import org.xmpp.packet.PacketError;
import org.apache.mina.transport.socket.nio.SocketAcceptorConfig;
import org.apache.mina.transport.socket.nio.SocketAcceptor;
import org.apache.mina.common.IoAcceptor;
import org.apache.mina.filter.codec.textline.TextLineCodecFactory;
import org.apache.mina.filter.codec.ProtocolCodecFilter;
import org.apache.mina.filter.LoggingFilter;
import java.net.*;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.net.UnknownHostException;
import java.util.*;
import java.nio.charset.Charset;
/**
* STUN Server and Service Module
......@@ -201,24 +196,14 @@ public class STUNService extends BasicModule implements ServerItemsProvider, Rou
reply.setChildElement(childElementCopy);
if ("http://jabber.org/protocol/disco#info".equals(namespace)) {
try {
reply = XMPPServer.getInstance().getIQDiscoInfoHandler().handleIQ(iq);
router.route(reply);
return;
}
catch (UnauthorizedException e) {
// Do nothing. This error should never happen
}
reply = XMPPServer.getInstance().getIQDiscoInfoHandler().handleIQ(iq);
router.route(reply);
return;
} else if ("http://jabber.org/protocol/disco#items".equals(namespace)) {
try {
// a component
reply = XMPPServer.getInstance().getIQDiscoItemsHandler().handleIQ(iq);
router.route(reply);
return;
}
catch (UnauthorizedException e) {
// Do nothing. This error should never happen
}
// a component
reply = XMPPServer.getInstance().getIQDiscoItemsHandler().handleIQ(iq);
router.route(reply);
return;
} else if (NAMESPACE.equals(namespace)) {
Element stun = childElementCopy.addElement("stun");
......
......@@ -13,8 +13,8 @@
<%@ page import="org.jivesoftware.wildfire.XMPPServer" %>
<%@ page import="org.jivesoftware.wildfire.mediaproxy.MediaProxyService" %>
<%@ page import="org.jivesoftware.wildfire.mediaproxy.MediaProxySession" %>
<%@ page import="org.jivesoftware.wildfire.mediaproxy.SmartSession" %>
<%@ page import="java.util.List" %>
<%@ page import="org.jivesoftware.wildfire.mediaproxy.RelaySession" %>
<%@ page import="java.util.Collection" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt" %>
......@@ -128,7 +128,7 @@
<td>
<input type="text" size="5" maxlength="8"
name="idleTimeout"
value="<%=(long)mediaProxyService.getIdleTime()/1000%>"
value="<%=mediaProxyService.getIdleTime()/1000%>"
align="left">
</td>
</tr>
......@@ -208,7 +208,7 @@
<tbody>
<% // Print the list of agents
List<MediaProxySession> sessions = mediaProxyService.getAgents();
Collection<MediaProxySession> sessions = mediaProxyService.getAgents();
if (sessions.isEmpty()) {
%>
<tr>
......@@ -243,7 +243,7 @@
<%=(System.currentTimeMillis() - proxySession.getTimestamp()) / 1000%>
</td>
<td width="10%">
<% if (proxySession instanceof SmartSession) { %>
<% if (proxySession instanceof RelaySession) { %>
Smart Session
<% } else { %>
Fixed Session
......
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