Identd in Proxy
[KiwiIRC.git] / server / client.js
index d2d76f05c3d0968f926b7920153f9af9235ab398..b8e7faff1c0f91673a1e33685d02b954d1aee0d3 100755 (executable)
@@ -16,7 +16,7 @@ var Client = function (websocket) {
     this.rpc = new WebsocketRpc(this.websocket);
 
     // Clients address
-    this.real_address = this.websocket.kiwi.real_address;
+    this.real_address = this.websocket.meta.real_address;
 
     // A hash to identify this client instance
     this.hash = crypto.createHash('sha256')
@@ -78,7 +78,8 @@ Client.prototype.dispose = function () {
 };
 
 function handleClientMessage(msg, callback) {
-    var server;
+    var that = this,
+        server;
 
     // Make sure we have a server number specified
     if ((msg.server === null) || (typeof msg.server !== 'number')) {
@@ -102,7 +103,13 @@ function handleClientMessage(msg, callback) {
     }
 
     // Run the client command
-    this.client_commands.run(msg.data.method, msg.data.args, server, callback);
+    global.modules.emit('client command', {
+        command: msg.data,
+        server: server
+    })
+    .done(function() {
+        that.client_commands.run(msg.data.method, msg.data.args, server, callback);
+    });
 }
 
 
@@ -131,7 +138,7 @@ function kiwiCommand(command, callback) {
                         global.config.restrict_server_ssl :
                         command.ssl),
                     command.nick,
-                    {hostname: this.websocket.kiwi.revdns, address: this.websocket.kiwi.real_address},
+                    {hostname: this.websocket.meta.revdns, address: this.websocket.meta.real_address},
                     options,
                     callback);
             } else {