- var con;
-
- if (global.config.restrict_server) {
- this.state.connect(
- global.config.restrict_server,
- global.config.restrict_server_port,
- global.config.restrict_server_ssl,
- command.nick,
- {hostname: this.websocket.handshake.revdns, address: this.websocket.handshake.real_address},
- global.config.restrict_server_password);
-
- } else {
- this.state.connect(
- command.hostname,
- command.port,
- command.ssl,
- command.nick,
- {hostname: this.websocket.handshake.revdns, address: this.websocket.handshake.real_address},
- command.password);
- }
+ var options = {};
+
+ // Get any optional parameters that may have been passed
+ if (command.encoding)
+ options.encoding = command.encoding;
+
+ options.password = global.config.restrict_server_password || command.password;
+
+ this.state.connect(
+ (global.config.restrict_server || command.hostname),
+ (global.config.restrict_server_port || command.port),
+ (typeof global.config.restrict_server_ssl !== 'undefined' ?
+ global.config.restrict_server_ssl :
+ command.ssl),
+ command.nick,
+ {hostname: this.websocket.meta.revdns, address: this.websocket.meta.real_address},
+ options,
+ callback);