Skip to content

Commit

Permalink
Merged pull request martynsmith#10 from jsocol/master.
Browse files Browse the repository at this point in the history
Add an event for `/invite`
  • Loading branch information
martynsmith committed Apr 29, 2011
2 parents 986f8ab + 379645c commit a85b3ab
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
6 changes: 6 additions & 0 deletions API.md
Expand Up @@ -134,6 +134,12 @@ As per 'message' event but only emits when the message is direct to the client

Emitted when a user changes nick along with the channels the user is in.

### Event: 'invite'

`function (channel, from) { }`

Emitted when the client recieves an `/invite`.

### Event: 'raw'

`function (message) { }`
Expand Down
12 changes: 9 additions & 3 deletions lib/irc.js
Expand Up @@ -505,7 +505,7 @@ function Client(server, nick, opt) {
nick: nick,
password: null,
userName: 'nodebot',
realName: 'nodeJS IRC client',
realName: 'nodeJS IRC client',
port: 6667,
debug: false,
showErrors: false,
Expand Down Expand Up @@ -731,6 +731,12 @@ function Client(server, nick, opt) {
if ( self.opt.debug && to == self.nick )
sys.log('GOT MESSAGE from ' + from + ': ' + text);
break;
case "INVITE":
var from = message.nick;
var to = message.args[0];
var channel = message.args[1];
self.emit('invite', channel, from);
break;
case "QUIT":
if ( self.opt.debug )
sys.log("QUIT: " + message.prefix + " " + message.args.join(" "));
Expand Down Expand Up @@ -875,7 +881,7 @@ Client.prototype.disconnect = function ( message ) { // {{{
self.send( "QUIT", message );
}
self.conn.requestedDisconnect = true;
self.conn.end();
self.conn.end();
}; // }}}
Client.prototype.send = function(command) { // {{{
var args = [];
Expand Down Expand Up @@ -919,7 +925,7 @@ Client.prototype.say = function(target, text) { // {{{

/*
* parseMessage(line)
*
*
* takes a raw "line" from the IRC server and turns it into an object with
* useful keys
*/
Expand Down

0 comments on commit a85b3ab

Please sign in to comment.