Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

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

Merged
merged 1 commit into from

2 participants

@alexwhitman

Implements #69

Would prompt a version change as the signature of the emit is changed.

@martynsmith
Owner

Any reason you wouldn't just put the channels as the last argument in the method signature? I concur that it's not quite as nice, but it definitely wouldn't break backward compatibility.

Thoughts?

@alexwhitman

I did it this way to keep the signatures consistent, with message always being the last. There's no reason why it couldn't be swapped around though.

@martynsmith martynsmith merged commit 02593ba into martynsmith:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 22, 2011
  1. @alexwhitman
This page is out of date. Refresh to see the latest.
Showing with 8 additions and 2 deletions.
  1. +3 −1 docs/API.rst
  2. +5 −1 lib/irc.js
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
@@ -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;
Something went wrong with that request. Please try again.