<commit_before><%@ taglib uri="core" prefix="c"%>
<%--
  -	$RCSfile$
  -	$Revision$
  -	$Date$
--%>

<%@ page import="org.jivesoftware.util.ParamUtils,
                 org.jivesoftware.messenger.JiveGlobals,
                 java.util.Map,
                 java.util.HashMap,
                 java.net.InetAddress" %>

<%@ include file="setup-global.jspf" %>

<%  // Get parameters
    String domain = ParamUtils.getParameter(request,"domain");
    int port = ParamUtils.getIntParameter(request,"port",-1);
    int embeddedPort = ParamUtils.getIntParameter(request,"embeddedPort",-1);
    int sslPort = ParamUtils.getIntParameter(request,"sslPort",-1);
    boolean sslEnabled = ParamUtils.getBooleanParameter(request,"sslEnabled");

    boolean doContinue = request.getParameter("continue") != null;

    // handle a continue request:
    Map errors = new HashMap();
    if (doContinue) {
        // Validate parameters
        if (domain == null) {
            errors.put("domain","domain");
        }
        if (port < 0) {
            errors.put("port","port");
        }
        if (embeddedPort < 0) {
            errors.put("embeddedPort","embeddedPort");
        }
        if (sslEnabled) {
            if (sslPort < 0) {
                errors.put("sslPort","sslPort");
            }
        }
        // Continue if there were no errors
        if (errors.size() == 0) {
            Map xmppSettings = new HashMap();

            xmppSettings.put("xmpp.domain",domain);
            xmppSettings.put("xmpp.socket.plain.port",Integer.toString(port));
            xmppSettings.put("embedded-web.port",Integer.toString(embeddedPort));
            xmppSettings.put("xmpp.socket.ssl.active",""+sslEnabled);
            xmppSettings.put("xmpp.socket.ssl.port",Integer.toString(sslPort));
            xmppSettings.put("xmpp.auth.anonymous", "true" );
            session.setAttribute("xmppSettings", xmppSettings);

            // update the sidebar status
            session.setAttribute("jive.setup.sidebar.2","done");
            session.setAttribute("jive.setup.sidebar.3","in_progress");

            // successful, so redirect
            response.sendRedirect("setup-datasource-settings.jsp");
            return;
        }
    }

    // Load the current values:
    if (!doContinue) {
        domain = JiveGlobals.getProperty("xmpp.domain");
        try {
            port = Integer.parseInt(JiveGlobals.getProperty("xmpp.socket.plain.port"));
        } catch (Exception ignored) {}
        try {
            embeddedPort = Integer.parseInt(JiveGlobals.getProperty("embedded-web.port"));
        } catch (Exception ignored) {}
        try {
            sslPort = Integer.parseInt(JiveGlobals.getProperty("xmpp.socket.ssl.port"));
        } catch (Exception ignored) {}
        sslEnabled = "true".equals(JiveGlobals.getProperty("xmpp.socket.ssl.active"));

        // If the domain is still blank, guess at the value:
        if (domain == null) {<commit_msg>SSL enabled by default<commit_after><%@ taglib uri="core" prefix="c"%>
<%--
  -	$RCSfile$
  -	$Revision$
  -	$Date$
--%>

<%@ page import="org.jivesoftware.util.ParamUtils,
                 org.jivesoftware.messenger.JiveGlobals,
                 java.util.Map,
                 java.util.HashMap,
                 java.net.InetAddress" %>

<%@ include file="setup-global.jspf" %>

<%  // Get parameters
    String domain = ParamUtils.getParameter(request,"domain");
    int port = ParamUtils.getIntParameter(request,"port",-1);
    int embeddedPort = ParamUtils.getIntParameter(request,"embeddedPort",-1);
    int sslPort = ParamUtils.getIntParameter(request,"sslPort",-1);
    boolean sslEnabled = ParamUtils.getBooleanParameter(request,"sslEnabled",true);

    boolean doContinue = request.getParameter("continue") != null;

    // handle a continue request:
    Map errors = new HashMap();
    if (doContinue) {
        // Validate parameters
        if (domain == null) {
            errors.put("domain","domain");
        }
        if (port < 0) {
            errors.put("port","port");
        }
        if (embeddedPort < 0) {
            errors.put("embeddedPort","embeddedPort");
        }
        if (sslEnabled) {
            if (sslPort < 0) {
                errors.put("sslPort","sslPort");
            }
        }
        // Continue if there were no errors
        if (errors.size() == 0) {
            Map xmppSettings = new HashMap();

            xmppSettings.put("xmpp.domain",domain);
            xmppSettings.put("xmpp.socket.plain.port",Integer.toString(port));
            xmppSettings.put("embedded-web.port",Integer.toString(embeddedPort));
            xmppSettings.put("xmpp.socket.ssl.active",""+sslEnabled);
            xmppSettings.put("xmpp.socket.ssl.port",Integer.toString(sslPort));
            xmppSettings.put("xmpp.auth.anonymous", "true" );
            session.setAttribute("xmppSettings", xmppSettings);

            // update the sidebar status
            session.setAttribute("jive.setup.sidebar.2","done");
            session.setAttribute("jive.setup.sidebar.3","in_progress");

            // successful, so redirect
            response.sendRedirect("setup-datasource-settings.jsp");
            return;
        }
    }

    // Load the current values:
    if (!doContinue) {
        domain = JiveGlobals.getProperty("xmpp.domain");
        port = JiveGlobals.getIntProperty("xmpp.socket.plain.port", 5222);
        embeddedPort = JiveGlobals.getIntProperty("embedded-web.port", 9090);
        sslPort = JiveGlobals.getIntProperty("xmpp.socket.ssl.port",5223);
        sslEnabled = JiveGlobals.getBooleanProperty("xmpp.socket.ssl.active", true);

        // If the domain is still blank, guess at the value:
        if (domain == null) {
{'fraction_non_alphanumeric': 0.1426585577758471, 'fraction_numerical': 0.005212858384013901, 'mean_word_length': 2.342624854819977, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1984748', 'n_tokens_mistral': 1726, 'n_tokens_neox': 1685, 'n_words': 274}