Commit 8cd96c3f authored by Daniel Henninger's avatar Daniel Henninger Committed by dhenninger

Web interface tweaks and playing with thread concepts.

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk@4696 b35dd754-fafc-0310-a699-88a17e54d16e
parent 3e654f12
...@@ -22,7 +22,7 @@ import org.xmpp.packet.JID; ...@@ -22,7 +22,7 @@ import org.xmpp.packet.JID;
* *
* @author Daniel Henninger * @author Daniel Henninger
*/ */
public abstract class TransportSession { public abstract class TransportSession implements Runnable {
/** /**
* Creates a TransportSession instance. * Creates a TransportSession instance.
...@@ -50,6 +50,11 @@ public abstract class TransportSession { ...@@ -50,6 +50,11 @@ public abstract class TransportSession {
*/ */
public JID jid; public JID jid;
/**
* Is this session valid? Set to false when session is done.
*/
public boolean validSession = true;
/** /**
* Retrieves the registration information associated with the session. * Retrieves the registration information associated with the session.
* *
...@@ -77,6 +82,20 @@ public abstract class TransportSession { ...@@ -77,6 +82,20 @@ public abstract class TransportSession {
return jid; return jid;
} }
/**
* Handles monitoring of whether session is still valid.
*/
public void run() {
while (validSession) { }
}
/**
* Indicates that the session is done and should be stopped.
*/
public void sessionDone() {
validSession = false;
}
/** /**
* Updates status on legacy service. * Updates status on legacy service.
* *
......
...@@ -20,6 +20,12 @@ ...@@ -20,6 +20,12 @@
<% <%
GatewayPlugin plugin = (GatewayPlugin)XMPPServer.getInstance().getPluginManager().getPlugin("gateway"); GatewayPlugin plugin = (GatewayPlugin)XMPPServer.getInstance().getPluginManager().getPlugin("gateway");
HashMap<String,Boolean> trEnabled = new HashMap<String,Boolean>();
trEnabled.put("aim", plugin.getTransportInstance("aim").isEnabled());
trEnabled.put("icq", plugin.getTransportInstance("icq").isEnabled());
//trEnabled.put("irc", plugin.getTransportInstance("irc").isEnabled());
trEnabled.put("msn", plugin.getTransportInstance("msn").isEnabled());
trEnabled.put("yahoo", plugin.getTransportInstance("yahoo").isEnabled());
String success = request.getParameter("success"); String success = request.getParameter("success");
webManager.init(request, response, session, application, out); webManager.init(request, response, session, application, out);
...@@ -32,6 +38,7 @@ ...@@ -32,6 +38,7 @@
long regId = ParamUtils.getLongParameter(request, "deleteid", -1); long regId = ParamUtils.getLongParameter(request, "deleteid", -1);
try { try {
Registration reg = new Registration(regId); Registration reg = new Registration(regId);
// TODO: Check if transport is enabled
plugin.getTransportInstance(reg.getTransportType().toString()).getTransport().deleteRegistration(reg.getJID()); plugin.getTransportInstance(reg.getTransportType().toString()).getTransport().deleteRegistration(reg.getJID());
response.sendRedirect("gateway-registrations.jsp?success=true"); response.sendRedirect("gateway-registrations.jsp?success=true");
return; return;
...@@ -77,6 +84,10 @@ ...@@ -77,6 +84,10 @@
String typeStr = ParamUtils.getParameter(request, "gatewayType"); String typeStr = ParamUtils.getParameter(request, "gatewayType");
String username = ParamUtils.getParameter(request, "gatewayUser"); String username = ParamUtils.getParameter(request, "gatewayUser");
String password = ParamUtils.getParameter(request, "gatewayPass"); String password = ParamUtils.getParameter(request, "gatewayPass");
if (!trEnabled.get(typeStr)) {
response.sendRedirect("gateway-registrations.jsp?success=false");
return;
}
try { try {
plugin.getTransportInstance(typeStr).getTransport().addNewRegistration(jid, username, password); plugin.getTransportInstance(typeStr).getTransport().addNewRegistration(jid, username, password);
response.sendRedirect("gateway-registrations.jsp?success=true"); response.sendRedirect("gateway-registrations.jsp?success=true");
...@@ -284,10 +295,10 @@ below and update the view.</p> ...@@ -284,10 +295,10 @@ below and update the view.</p>
<div class="jive-registrations-addGateway"> <div class="jive-registrations-addGateway">
<select name="gatewayType" size="1"> <select name="gatewayType" size="1">
<option value="0" SELECTED> -- select -- </option> <option value="0" SELECTED> -- select -- </option>
<option value="aim">AIM</option> <% if (trEnabled.get("aim")) { %> <option value="aim">AIM</option> <% } %>
<option value="icq">ICQ</option> <% if (trEnabled.get("icq")) { %> <option value="icq">ICQ</option> <% } %>
<option value="msn">MSN</option> <% if (trEnabled.get("msn")) { %> <option value="msn">MSN</option> <% } %>
<option value="yahoo">Yahoo</option> <% if (trEnabled.get("yahoo")) { %> <option value="yahoo">Yahoo</option> <% } %>
</select><br> </select><br>
<strong>gateway</strong> <strong>gateway</strong>
</div> </div>
......
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