nandub / hubot-irc

IRC adapter for Hubot
MIT License
299 stars 128 forks source link

HUBOT_IRC_IGNOREINVITE has opposite effect #163

Open shortspecialbus opened 8 years ago

shortspecialbus commented 8 years ago

Hi,

I noticed my bot was accepting invites to random channels despite having both HUBOT_IRC_PRIVATE and HUBOT_IRC_IGNOREINVITE set to 'true.'

Some investigation found the issue. Line 333 in irc.coffee is:

  if not process.env.HUBOT_IRC_PRIVATE or process.env.HUBOT_IRC_IGNOREINVITE

This actually seems to work opposite - the order of operations is wrong. I believe it works out as

If (not process.env.HUBOT_IRC_PRIVATE) or (process.env.HUBOT_IRC_IGNOREINVITE)

So, if you set it, it won't ignore the invite. This is fixed by either unsetting HUBOT_IRC_IGNOREINVITE which is more of a workaround than a fix, or the following change. I don't know coffeescript but I was able to fix it in my test by changing the line to:

  if not process.env.HUBOT_IRC_PRIVATE or not process.env.HUBOT_IRC_IGNOREINVITE

But I'm not 100% sure that's the correct fix, hence why I'm not doing a pull. Thought I'd mention it in here though.

-stefan