Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

provide message object to ctcp events #130

Merged
merged 3 commits into from

2 participants

@damianb

As on tin. See #126 for justification and more info.

Apologies for not using a dedicated branch, on cr48 at the moment, no git available right now.

damianb added some commits
@damianb damianb add 'message' parameter to ctcp events
message parameter is similar to that provided by message events
ec49854
@damianb damianb Update lib/irc.js
Forgot one.
c6ce76d
@damianb damianb Update docs/API.rst aa07660
@damianb

Ping.

@martynsmith martynsmith merged commit eb24a0a into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 8, 2013
  1. @damianb

    add 'message' parameter to ctcp events

    damianb authored
    message parameter is similar to that provided by message events
  2. @damianb

    Update lib/irc.js

    damianb authored
    Forgot one.
  3. @damianb

    Update docs/API.rst

    damianb authored
This page is out of date. Refresh to see the latest.
Showing with 15 additions and 12 deletions.
  1. +8 −5 docs/API.rst
  2. +7 −7 lib/irc.js
View
13 docs/API.rst
@@ -303,28 +303,31 @@ Events
.. js:data:: 'ctcp'
- `function (from, to, text, type) { }`
+ `function (from, to, text, type, message) { }`
Emitted when a CTCP notice or privmsg was received (`type` is either `'notice'`
- or `'privmsg'`).
+ or `'privmsg'`). See the `raw` event for details on the `message` object.
.. js:data:: 'ctcp-notice'
- `function (from, to, text) { }`
+ `function (from, to, text, message) { }`
Emitted when a CTCP notice was received.
+ See the `raw` event for details on the `message` object.
.. js:data:: 'ctcp-privmsg'
- `function (from, to, text) { }`
+ `function (from, to, text, message) { }`
Emitted when a CTCP privmsg was received.
+ See the `raw` event for details on the `message` object.
.. js:data:: 'ctcp-version'
- `function (from, to) { }`
+ `function (from, to, message) { }`
Emitted when a CTCP VERSION request was received.
+ See the `raw` event for details on the `message` object.
.. js:data:: 'nick'
View
14 lib/irc.js
@@ -206,7 +206,7 @@ function Client(server, nick, opt) {
}
var text = message.args[1];
if (text[0] === '\1' && text.lastIndexOf('\1') > 0) {
- self._handleCTCP(from, to, text, 'notice');
+ self._handleCTCP(from, to, text, 'notice', message);
break;
}
self.emit('notice', from, to, text, message);
@@ -465,7 +465,7 @@ function Client(server, nick, opt) {
var to = message.args[0];
var text = message.args[1];
if (text[0] === '\1' && text.lastIndexOf('\1') > 0) {
- self._handleCTCP(from, to, text, 'privmsg');
+ self._handleCTCP(from, to, text, 'privmsg', message);
break;
}
self.emit('message', from, to, text, message);
@@ -811,16 +811,16 @@ Client.prototype._clearWhoisData = function(nick) { // {{{
delete this._whoisData[nick];
return data;
} // }}}
-Client.prototype._handleCTCP = function(from, to, text, type) {
+Client.prototype._handleCTCP = function(from, to, text, type, message) {
text = text.slice(1)
text = text.slice(0, text.indexOf('\1'))
var parts = text.split(' ')
- this.emit('ctcp', from, to, text, type)
- this.emit('ctcp-'+type, from, to, text)
+ this.emit('ctcp', from, to, text, type, message)
+ this.emit('ctcp-'+type, from, to, text, message)
if (type === 'privmsg' && text === 'VERSION')
- this.emit('ctcp-version', from, to)
+ this.emit('ctcp-version', from, to, message)
if (parts[0] === 'ACTION' && parts.length > 1)
- this.emit('action', from, to, parts.slice(1).join(' '))
+ this.emit('action', from, to, parts.slice(1).join(' '), message)
if (parts[0] === 'PING' && type === 'privmsg' && parts.length > 1)
this.ctcp(from, 'notice', text)
}
Something went wrong with that request. Please try again.