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

Include channels user was in when 'kill' is emitted #72

Merged
merged 1 commit into from Jan 7, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion docs/API.rst
Expand Up @@ -222,9 +222,11 @@ Events

.. js:data:: 'kill'

`function (nick, reason, message) { }`
`function (nick, reason, channels, message) { }`

Emitted when a user is killed from the IRC server.
`channels` is an array of channels the killed user was in which
are known to the client.
See the `raw` event for details on the `message` object.

.. js:data:: 'message'
Expand Down
6 changes: 5 additions & 1 deletion lib/irc.js
Expand Up @@ -349,10 +349,14 @@ function Client(server, nick, opt) {
break;
case "KILL":
var nick = message.args[0];
self.emit('kill', nick, message.args[1], message);
var channels = [];
for ( var channel in self.chans ) {
if ( self.chans[channel].users[nick])
channels.push(channel);

delete self.chans[channel].users[nick];
}
self.emit('kill', nick, message.args[1], channels, message);
break;
case "PRIVMSG":
var from = message.nick;
Expand Down