Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added joins to password protected channels #75

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions src/plugin/action/join.sjs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -104,10 +108,14 @@ module.exports = function (client, rawf, emitter) {
};

client.debug("PluginAction", formatc("Attempting to join %s."));
Copy link
Member

@Havvy Havvy Aug 8, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will print "[Object object]" if type is object. As such, this debug needs to be inside the else case, and a different debug needs to be inside the passworded version.

Note: This is addressed by normalizing the input into two variables at the top of the function.

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);
});
};
};
};