From 8b8a09ac976f4276052f9bf43176002af8685014 Mon Sep 17 00:00:00 2001 From: Evert Date: Sat, 24 Sep 2016 16:24:55 +0300 Subject: [PATCH] CRITICAL FIX: retarded config system --- server/irc.js | 44 ++++++++++++++++---------------------------- 1 file changed, 16 insertions(+), 28 deletions(-) diff --git a/server/irc.js b/server/irc.js index e0410d8..5ce75b5 100644 --- a/server/irc.js +++ b/server/irc.js @@ -3,18 +3,6 @@ let net = require('net'); let configuration = require(__dirname+"/config"); let parse = require(__dirname+"/parser"); -let defaultConfig = { - nickname: "teemant", - username: configuration.client.username, - realname: configuration.client.realname, - server: "localhost", - port: 6667, - autojoin: [], - secure: configuration.client.secure_by_default, - password: "", - address: "0.0.0.0" -} - if (!String.prototype.format) { String.prototype.format = function() { var args = arguments; @@ -24,20 +12,6 @@ if (!String.prototype.format) { }; } -class ConfigPatcher { - constructor(provided, defaults) { - this.result = defaults; - this.patches = provided; - } - - patch() { - for(let a in this.patches) { - this.result[a] = this.patches[a]; - } - return this.result; - } -} - class IRCConnectionHandler { constructor(connection) { this.conn = connection; @@ -224,9 +198,23 @@ class IRCConnectionHandler { class IRCConnection extends EventEmitter { constructor(providedInfo) { super(); - let config_u = new ConfigPatcher(providedInfo, defaultConfig); - this.config = config_u.patch(); + this.config = { + nickname: "teemant", + username: configuration.client.username, + realname: configuration.client.realname, + server: "localhost", + port: 6667, + autojoin: [], + secure: configuration.client.secure_by_default, + password: "", + address: "0.0.0.0" + }; + + for(let a in providedInfo) { + this.config[a] = providedInfo[a]; + } + this.socket = null; this.connected = false; this.authenticated = false;