Skip to content

Commit

Permalink
Merge pull request #72 from whitman/emit-kill-channels
Browse files Browse the repository at this point in the history
Include channels user was in when 'kill' is emitted
  • Loading branch information
martynsmith committed Jan 7, 2012
2 parents 9c12958 + 1db7c0e commit 02593ba
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 3 additions & 1 deletion docs/API.rst
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
Expand Up @@ -358,10 +358,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

0 comments on commit 02593ba

Please sign in to comment.