From 8fa145b012a6d2f40f038e907a16f4aa12febd11 Mon Sep 17 00:00:00 2001 From: Mattias Erming Date: Thu, 19 Jun 2014 01:26:28 +0200 Subject: [PATCH] Minor bugfix --- lib/server.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/server.js b/lib/server.js index d16f030c..a26d26e8 100644 --- a/lib/server.js +++ b/lib/server.js @@ -116,6 +116,16 @@ function connect(params) { client.nick(params.nick); client.user(params.nick, params.realname); + events.forEach(function(e) { + client.on(e, function() { + event.apply(network, [e, arguments]); + }); + }); + + if (!params.onConnect) { + return; + } + client.once("welcome", function() { (params.onConnect.join || []).forEach(function(chan) { client.join.apply( @@ -140,12 +150,6 @@ function connect(params) { delay += 1000; }); }); - - events.forEach(function(e) { - client.on(e, function() { - event.apply(network, [e, arguments]); - }); - }); } function auth(password) {