Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #72 from whitman/emit-kill-channels

Include channels user was in when 'kill' is emitted
  • Loading branch information...
commit 02593ba3b66eee30f695aa00186f0dbf0a43d68a 2 parents 9c12958 + 1db7c0e
@martynsmith authored
Showing with 8 additions and 2 deletions.
  1. +3 −1 docs/API.rst
  2. +5 −1 lib/irc.js
View
4 docs/API.rst
@@ -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'
View
6 lib/irc.js
@@ -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;
Please sign in to comment.
Something went wrong with that request. Please try again.