From 1414d634fdda2615e4ab32242f406fef202d505b Mon Sep 17 00:00:00 2001 From: boudin Date: Mon, 3 Nov 2014 17:45:39 +0100 Subject: [PATCH] Added a method to retrieve buffers from controler and logs to debug --- bin/test-server.js | 8 +++++++- lib/controler.js | 10 +++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/bin/test-server.js b/bin/test-server.js index 08265ab..4f9b8a2 100644 --- a/bin/test-server.js +++ b/bin/test-server.js @@ -14,7 +14,13 @@ server.createServer(3219, "127.0.0.1", function (password) { process.stdin.on("data", function(data) { if (data.toString() !== "exit"){ - eval(data.toString()); + try { + console.log("CMD : "+data.toString()); + console.log("RETURNED : "+eval(data.toString())); + } + catch (ex) { + console.log("Erreur : "+ex.message) + } } else { diff --git a/lib/controler.js b/lib/controler.js index b6c89c0..c44f9f3 100644 --- a/lib/controler.js +++ b/lib/controler.js @@ -59,7 +59,7 @@ function NetbeansClient(socket, authentication, onEvent, onError, onDisconnected messageTransform.on("data",function (data) { var message = data.toString(); - console.log(message); + console.log("MSG : "+message); /* The first message must be an authentication one */ if (message.indexOf("AUTH ") === 0 && authentication(message.substring(message.indexOf(" ") + 1))) { @@ -68,7 +68,7 @@ function NetbeansClient(socket, authentication, onEvent, onError, onDisconnected messageTransform.removeAllListeners("data"); messageTransform.on("data", function(data) { var message = data.toString(); - console.log(message); + console.log("MSG "+message); try { var iName = 0; /*Index of the name separator in case of an Event */ @@ -364,7 +364,7 @@ function Controler(socket, authentication) { }; - /* CONNEXION CONTROL */ + /* CONNTROLER CONTROL */ //Close the underlying connexion with Vim, but not Vim this.detach = function () { @@ -377,6 +377,10 @@ function Controler(socket, authentication) { socket.end("DISCONNECT\n"); self.emit("disconnected"); }; + + this.getBuffer = function(buffId) { + return buffers[buffId]; + }; } Controler.prototype = EventEmitter.prototype;