ekmartin / slack-irc

Connects Slack and IRC channels by sending messages back and forth.
MIT License
588 stars 157 forks source link

Quit messages go to all rooms. #84

Closed jaredkipe closed 8 years ago

jaredkipe commented 8 years ago

Good work on this project. I've only been using it for a couple of hours, but it seems to work well and gets me out of having to have an IRC client open all the time. (Hopefully it re-joins easily on its own)

I have both Join and Leave messages turned on in my config.

When a user joins in an irc room, the join message is only in room they joined. (meaning they joined an IRC room that is bound to a slack room, that slack room gets a join message). When a user leaves(quits), the message is in all irc bound rooms. (meaning the message is broadcast to all of the rooms the bot is in.

ekmartin commented 8 years ago

Hi! It's supposed to loop through the rooms that the user is a part of, which the Slack bot also is in. See https://github.com/ekmartin/slack-irc/blob/master/lib%2Fbot.js#L129-L131

If the leave message is broadcast to a Slack room connected to an IRC channel the user wasn't a part of, that's a bug. Could you check if that was the case, or if the user was indeed in the room?

jaredkipe commented 8 years ago

They certainly are not, I'm in two rooms that have vastly different user bases. Every time someone joins, I see the join in the right room. But when they quit, all of the rooms get the quit notice.

Perhaps its an issue with the dependency. Looking through the irc 'QUIT' event, it certainly seems that it tries to keep track of what channels the nick was in... On line 488 it appears to me that its registering an empty string as a placeholder in the channel.users object. But then on 583 (quit), it walks the channels, simply deleting the user keys and pushing ALL of the channels onto the event's channels array. 853 has a 'TODO better way of finding what channels a user is in?' so I guess thats why...

ekmartin commented 8 years ago

Yes, seems like it's a bug with node-irc: https://github.com/martynsmith/node-irc/issues/398