Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Added user message support for PART #119

Closed
wants to merge 3 commits into from

1 participant

This page is out of date. Refresh to see the latest.
Showing with 8 additions and 3 deletions.
  1. +2 −1  docs/API.rst
  2. +6 −2 lib/irc.js
View
3  docs/API.rst
@@ -78,11 +78,12 @@ Client
supports multiple JOIN arguments as a space separated string (similar to
the IRC protocol).
-.. js:function:: Client.part(channel, callback)
+.. js:function:: Client.part(channel, message, callback)
Parts the specified channel.
:param string channel: Channel to part
+ :param string message: Optional message to send upon leaving the channel
:param function callback: Callback to automatically subscribed to the
`part#channel` event, but removed after the first invocation.
View
8 lib/irc.js
@@ -742,7 +742,11 @@ Client.prototype.join = function(channel, callback) { // {{{
});
this.send.apply(this, ['JOIN'].concat(channel.split(' ')));
} // }}}
-Client.prototype.part = function(channel, callback) { // {{{
+Client.prototype.part = function(channel, message, callback) { // {{{
+ if ( typeof(message) === 'function' ) {
+ callback = message;
+ message = undefined;
+ }
if ( typeof(callback) == 'function' ) {
this.once('part' + channel, callback);
}
@@ -753,7 +757,7 @@ Client.prototype.part = function(channel, callback) { // {{{
this.opt.channels.splice(this.opt.channels.indexOf(channel), 1);
}
- this.send('PART', channel);
+ this.send('PART', channel, message);
} // }}}
Client.prototype.say = function(target, text) { // {{{
var self = this;
Something went wrong with that request. Please try again.