Revert "Server: Removed hostname from 'server:*' event names"
authorDarren <darren@darrenwhitlen.com>
Fri, 1 Feb 2013 14:33:59 +0000 (14:33 +0000)
committerDarren <darren@darrenwhitlen.com>
Fri, 1 Feb 2013 14:33:59 +0000 (14:33 +0000)
This reverts commit 453c792f848d037e99a81b61fbffb5b52366c527.

server/irc/commands.js
server/irc/server.js

index c6fce94fa3d8c578ca2f03a9499e5110efc88374..1678b726ee4bdd80f52e05bd7c3d26fbebe5bfe5 100644 (file)
@@ -96,7 +96,7 @@ var listeners = {
         var nick =  command.params[0];
         this.irc_connection.registered = true;
         this.cap_negotation = false;
-        this.irc_connection.emit('server:connect', {
+        this.irc_connection.emit('server:' + this.irc_connection.irc_host.hostname + ':connect', {
             nick: nick
         });
     },
@@ -125,7 +125,7 @@ var listeners = {
                 }
             }
         }
-        this.irc_connection.emit('server:options', {
+        this.irc_connection.emit('server:'  + this.irc_connection.irc_host.hostname + ':options', {
             options: this.irc_connection.options,
             cap: this.irc_connection.cap.enabled
         });
@@ -182,28 +182,28 @@ var listeners = {
         });
     },
     'RPL_LISTSTART': function (command) {
-        this.irc_connection.emit('server:list_start', {});
+        this.irc_connection.emit('server:' + this.irc_connection.irc_host.hostname + ':list_start', {});
     },
     'RPL_LISTEND': function (command) {
-        this.irc_connection.emit('server:list_end', {});
+        this.irc_connection.emit('server:' + this.irc_connection.irc_host.hostname + ':list_end', {});
     },
     'RPL_LIST': function (command) {
-        this.irc_connection.emit('server:list_channel', {
+        this.irc_connection.emit('server:' + this.irc_connection.irc_host.hostname + ':list_channel', {
             channel: command.params[1],
             num_users: parseInt(command.params[2], 10),
             topic: command.trailing
         });
     },
     'RPL_MOTD': function (command) {
-        this.irc_connection.emit('server:motd', {
+        this.irc_connection.emit('server:'  + this.irc_connection.irc_host.hostname + ':motd', {
             motd: command.trailing + '\n'
         });
     },
     'RPL_MOTDSTART': function (command) {
-        this.irc_connection.emit('server:motd_start', {});
+        this.irc_connection.emit('server:'  + this.irc_connection.irc_host.hostname + ':motd_start', {});
     },
     'RPL_ENDOFMOTD': function (command) {
-        this.irc_connection.emit('server:motd_end', {});
+        this.irc_connection.emit('server:'  + this.irc_connection.irc_host.hostname + ':motd_end', {});
     },
     'RPL_NAMEREPLY': function (command) {
         var members = command.trailing.split(' ');
@@ -567,82 +567,82 @@ var listeners = {
         // noop
     },
     'ERROR': function (command) {
-        this.irc_connection.emit('server:error', {
+        this.irc_connection.emit('server:' + this.irc_connection.irc_host.hostname + ':error', {
             reason: command.trailing
         });
     },
     ERR_PASSWDMISMATCH: function (command) {
-        this.irc_connection.emit('server:password_mismatch', {});
+        this.irc_connection.emit('server:' + this.irc_connection.irc_host.hostname + ':password_mismatch', {});
     },
     ERR_LINKCHANNEL: function (command) {
-        this.irc_connection.emit('server:channel_redirect', {
+        this.irc_connection.emit('server:' + this.irc_connection.irc_host.hostname + ':channel_redirect', {
             from: command.params[1],
             to: command.params[2]
         });
     },
     ERR_NOSUCHNICK: function (command) {
-        this.irc_connection.emit('server:no_such_nick', {
+        this.irc_connection.emit('server:' + this.irc_connection.irc_host.hostname + ':no_such_nick', {
             nick: command.params[1],
             reason: command.trailing
         });
     },
     ERR_CANNOTSENDTOCHAN: function (command) {
-        this.irc_connection.emit('server:cannot_send_to_chan', {
+        this.irc_connection.emit('server:' + this.irc_connection.irc_host.hostname + ':cannot_send_to_chan', {
             channel: command.params[1],
             reason: command.trailing
         });
     },
     ERR_TOOMANYCHANNELS: function (command) {
-        this.irc_connection.emit('server:too_many_channels', {
+        this.irc_connection.emit('server:' + this.irc_connection.irc_host.hostname + ':too_many_channels', {
             channel: command.params[1],
             reason: command.trailing
         });
     },
     ERR_USERNOTINCHANNEL: function (command) {
-        this.irc_connection.emit('server:user_not_in_channel', {
+        this.irc_connection.emit('server:' + this.irc_connection.irc_host.hostname + ':user_not_in_channel', {
             nick: command.params[0],
             channel: command.params[1],
             reason: command.trailing
         });
     },
     ERR_NOTONCHANNEL: function (command) {
-        this.irc_connection.emit('server:not_on_channel', {
+        this.irc_connection.emit('server:' + this.irc_connection.irc_host.hostname + ':not_on_channel', {
             channel: command.params[1],
             reason: command.trailing
         });
     },
     ERR_CHANNELISFULL: function (command) {
-            this.irc_connection.emit('server:channel_is_full', {
+            this.irc_connection.emit('server:' + this.irc_connection.irc_host.hostname + ':channel_is_full', {
                 channel: command.params[1],
                 reason: command.trailing
             });
         },
     ERR_INVITEONLYCHAN: function (command) {
-        this.irc_connection.emit('server:invite_only_channel', {
+        this.irc_connection.emit('server:' + this.irc_connection.irc_host.hostname + ':invite_only_channel', {
             channel: command.params[1],
             reason: command.trailing
         });
     },
     ERR_BANNEDFROMCHAN: function (command) {
-        this.irc_connection.emit('server:banned_from_channel', {
+        this.irc_connection.emit('server:' + this.irc_connection.irc_host.hostname + ':banned_from_channel', {
             channel: command.params[1],
             reason: command.trailing
         });
     },
     ERR_BADCHANNELKEY: function (command) {
-        this.irc_connection.emit('server:bad_channel_key', {
+        this.irc_connection.emit('server:' + this.irc_connection.irc_host.hostname + ':bad_channel_key', {
             channel: command.params[1],
             reason: command.trailing
         });
     },
     ERR_CHANOPRIVSNEEDED: function (command) {
-        this.irc_connection.emit('server:chanop_privs_needed', {
+        this.irc_connection.emit('server:' + this.irc_connection.irc_host.hostname + ':chanop_privs_needed', {
             channel: command.params[1],
             reason: command.trailing
         });
     },
     ERR_NICKNAMEINUSE: function (command) {
-        this.irc_connection.emit('server:nickname_in_use', {
+        this.irc_connection.emit('server:' + this.irc_connection.irc_host.hostname + ':nickname_in_use', {
             nick: command.params[1],
             reason: command.trailing
         });
index 20a00d0bef5a168b9b63fd4f9b059125ed8554a3..d7498460d2c8adfb2a81ffb0ca81b6cf6ea744b2 100755 (executable)
@@ -2,8 +2,10 @@ var util    = require('util'),
     EventBinder  = require('./eventbinder.js'),
     _ = require('lodash');
 
-var IrcServer = function (irc_connection) {
+var IrcServer = function (irc_connection, host, port) {
     this.irc_connection = irc_connection;
+    this.host = host;
+    this.port = port;
 
     this.list_buffer = [];
     this.motd_buffer = '';
@@ -32,7 +34,7 @@ var IrcServer = function (irc_connection) {
         chanop_privs_needed:    onChanopPrivsNeeded,
         nickname_in_use:        onNicknameInUse
     };
-    EventBinder.bindIrcEvents('server', this.irc_events, this, this.irc_connection);
+    EventBinder.bindIrcEvents('server:' + this.host, this.irc_events, this, this.irc_connection);
     
 
 };
@@ -42,7 +44,7 @@ module.exports = IrcServer;
 
 
 IrcServer.prototype.dispose = function (){
-    EventBinder.unbindIrcEvents('server', this.irc_events, this.irc_connection);
+    EventBinder.unbindIrcEvents('server:' + this.host, this.irc_events, this.irc_connection);
     this.irc_connection = undefined;
 };