All pastes #25924 Raw Edit

Mine

public text v1 · immutable
#25924 ·published 2005-10-19 03:04 UTC
rendered paste body
    private void updateConfigGeneric(Properties config) {
        config.setProperty("type", _type);
        if (_name != null)
            config.setProperty("name", _name);
        if (_description != null)
            config.setProperty("description", _description);
        if (_i2cpHost != null)
            config.setProperty("i2cpHost", _i2cpHost);
        if ( (_i2cpPort != null) && (_i2cpPort.trim().length() > 0) )
            config.setProperty("i2cpPort", _i2cpPort);
        else
            config.setProperty("i2cpPort", "7654");
        
        if (_customOptions != null) {
            StringTokenizer tok = new StringTokenizer(_customOptions);
            while (tok.hasMoreTokens()) {
                String pair = tok.nextToken();
                int eq = pair.indexOf('=');
                if ( (eq <= 0) || (eq >= pair.length()) )
                    continue;
                String key = pair.substring(0, eq);
                String val = pair.substring(eq+1);
                if ("inbound.length".equals(key)) continue;
                if ("outbound.length".equals(key)) continue;
                if ("inbound.quantity".equals(key)) continue;
                if ("outbound.quantity".equals(key)) continue;
                if ("inbound.lengthVariance".equals(key)) continue;
                if ("outbound.lengthVariance".equals(key)) continue;
                if ("inbound.backupQuantity".equals(key)) continue;
                if ("outbound.backupQuantity".equals(key)) continue;
                if ("inbound.nickname".equals(key)) continue;
                if ("outbound.nickname".equals(key)) continue;
                if ("i2p.streaming.connectDelay".equals(key)) continue;
                if ("i2p.streaming.maxWindowSize".equals(key)) continue;
                config.setProperty("option." + key, val);
            }
        }

        config.setProperty("startOnLoad", _startOnLoad + "");

        if (_tunnelCount != null) {
            config.setProperty("option.inbound.quantity", _tunnelCount);
            config.setProperty("option.outbound.quantity", _tunnelCount);
        }
        if (_tunnelDepth != null) {
            config.setProperty("option.inbound.length", _tunnelDepth);
            config.setProperty("option.outbound.length", _tunnelDepth);
        }
        if (_tunnelVariance != null) {
            config.setProperty("option.inbound.lengthVariance", _tunnelVariance);
            config.setProperty("option.outbound.lengthVariance", _tunnelVariance);
        }
        if (_tunnelBackupCount != null) {
            config.setProperty("option.inbound.backupQuantity", _tunnelBackupCount);
            config.setProperty("option.outbound.backupQuantity", _tunnelBackupCount);
        }
        if (_connectDelay)
            config.setProperty("option.i2p.streaming.connectDelay", "1000");
        else
            config.setProperty("option.i2p.streaming.connectDelay", "0");
        if (_name != null) {
            if ( ((!"client".equals(_type)) && (!"httpclient".equals(_type))&& (!"ircclient".equals(_type))) || (!_sharedClient) ) {
                config.setProperty("option.inbound.nickname", _name);
                config.setProperty("option.outbound.nickname", _name);
            } else {
                config.setProperty("option.inbound.nickname", CLIENT_NICKNAME);
                config.setProperty("option.outbound.nickname", CLIENT_NICKNAME);
            }
        } 
        if ("interactive".equals(_profile))
            config.setProperty("option.i2p.streaming.maxWindowSize", "1");
        else
            config.remove("option.i2p.streaming.maxWindowSize");
    }