From: Darren Date: Wed, 23 Jan 2013 23:21:47 +0000 (+0000) Subject: IrcChannel + IrcCommands topic event X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=f4ec5774697dd2d9b06c8f26405e9a24f9a75e16;p=KiwiIRC.git IrcChannel + IrcCommands topic event --- diff --git a/server/irc/channel.js b/server/irc/channel.js index 479f09a..1d47dbd 100644 --- a/server/irc/channel.js +++ b/server/irc/channel.js @@ -22,6 +22,8 @@ function IrcChannel(irc_connection, name) { bindEvent('ctcp_request', this.onCtcpRequest); bindEvent('ctcp_response', this.onCtcpResponse); + bindEvent('topic', this.onTopic) + bindEvent('nicklist', this.onNicklist); bindEvent('nicklistEnd', this.onNicklistEnd); } @@ -61,7 +63,7 @@ IrcChannel.prototype.onPart = function (event) { IrcChannel.prototype.onKick = function (event) { this.client.sendIrcCommand('kick', { - kicked: event.params[1], // Nick of the kicked + kicked: event.kicked, // Nick of the kicked nick: event.nick, // Nick of the kicker ident: event.ident, hostname: event.hostname, @@ -83,7 +85,6 @@ IrcChannel.prototype.onQuit = function (event) { IrcChannel.prototype.onMsg = function (event) { this.clientEvent('msg', { - server: this.con_num, nick: event.nick, ident: event.ident, hostname: event.hostname, @@ -95,7 +96,6 @@ IrcChannel.prototype.onMsg = function (event) { IrcChannel.prototype.onNotice = function (event) { this.clientEvent('msg', { - server: this.con_num, nick: event.nick, ident: event.ident, hostname: event.hostname, @@ -145,6 +145,15 @@ IrcChannel.prototype.onNicklistEnd = function (event) { }); }; + +IrcChannel.prototype.onTopic = function (event) { + this.clientEvent('topic', { + nick: event.nick, + channel: this.name, + topic: event.topic + }); +}; + /* server:event server:* diff --git a/server/irc/commands.js b/server/irc/commands.js index cb39d57..452e959 100644 --- a/server/irc/commands.js +++ b/server/irc/commands.js @@ -318,7 +318,11 @@ var listeners = { var channel = command.params[0], topic = command.trailing || ''; - this.client.sendIrcCommand('topic', {server: this.con_num, nick: command.nick, channel: channel, topic: topic}); + this.irc_connection.emit('channel:' + channel + ':topic', { + nick: command.nick, + channel: channel, + topic: topic + }); }, 'MODE': function (command) { var chanmodes = this.irc_connection.options.CHANMODES || [],