From 742aaf77039d1b74498fdb8dca07967e7d9eb8fb Mon Sep 17 00:00:00 2001 From: akainocode Date: Mon, 8 Aug 2016 01:32:10 -0500 Subject: [PATCH 1/2] Adds the ability to join a password protected channel. In the config.json, instead of "#channel" one can use {"channel":"#channel", "password":"password"} --- src/plugin/action/join.sjs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/plugin/action/join.sjs b/src/plugin/action/join.sjs index c73953d..4314382 100644 --- a/src/plugin/action/join.sjs +++ b/src/plugin/action/join.sjs @@ -11,7 +11,11 @@ module.exports = function (client, rawf, emitter) { reject(new Error("No channel given to join action.")); return; } - + var password; + if (typeof(channel) === "object"){ + password = channel.password; + channel = channel.channel; + } const joinInfo = { names: [], channel: channel, @@ -104,10 +108,15 @@ module.exports = function (client, rawf, emitter) { }; client.debug("PluginAction", formatc("Attempting to join %s.")); - rawf("JOIN :%s", channel); + if (password !== undefined){ + rawf("JOIN %s :%s", channel, password); + } + else { + rawf("JOIN :%s", channel); + } }) .tap(function (result) { emitter.emit("join", result); }); }; -}; \ No newline at end of file +}; From ed30511d02102efd8777fab90ee05b74f508cb13 Mon Sep 17 00:00:00 2001 From: akainocode Date: Tue, 9 Aug 2016 02:11:45 -0500 Subject: [PATCH 2/2] Style: Fixed Formatting --- src/plugin/action/join.sjs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/plugin/action/join.sjs b/src/plugin/action/join.sjs index 4314382..bf84fb0 100644 --- a/src/plugin/action/join.sjs +++ b/src/plugin/action/join.sjs @@ -12,7 +12,7 @@ module.exports = function (client, rawf, emitter) { return; } var password; - if (typeof(channel) === "object"){ + if (typeof(channel) === "object") { password = channel.password; channel = channel.channel; } @@ -108,10 +108,9 @@ module.exports = function (client, rawf, emitter) { }; client.debug("PluginAction", formatc("Attempting to join %s.")); - if (password !== undefined){ + if (password !== undefined) { rawf("JOIN %s :%s", channel, password); - } - else { + } else { rawf("JOIN :%s", channel); } })