IrcChannel + IrcCommands topic event
authorDarren <darren@darrenwhitlen.com>
Wed, 23 Jan 2013 23:21:47 +0000 (23:21 +0000)
committerDarren <darren@darrenwhitlen.com>
Thu, 31 Jan 2013 14:58:42 +0000 (14:58 +0000)
server/irc/channel.js
server/irc/commands.js

index 479f09a766a9fcf444c1b3d0832c1d0406e007dd..1d47dbdc29e5634a125941f96180a50baf52b270 100644 (file)
@@ -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:*
index cb39d57b20d4651dda7502f2bbbb812ac1fd458a..452e959835dee0db1f7affdbbe108d38b78239f8 100644 (file)
@@ -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 || [],