From c6a7cd9027150fca42500b3bbc78be01993856f6 Mon Sep 17 00:00:00 2001 From: lassulus Date: Mon, 11 Nov 2013 20:16:45 +0100 Subject: webchat: request handling --- webchat/serverCommands.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'webchat/serverCommands.js') diff --git a/webchat/serverCommands.js b/webchat/serverCommands.js index dd755a97..303c4805 100644 --- a/webchat/serverCommands.js +++ b/webchat/serverCommands.js @@ -1,5 +1,10 @@ var serverCommands = {}; -serverCommands.say = function (serverstate, settings, params) { + +serverCommands.coi = function (serverstate, settings, params, id) { + return settings.conn.write({ result: { nick: settings.nick, addr: settings.addr}, id: id}) +} + +serverCommands.say = function (serverstate, settings, params, id) { var nick = settings.nick var message = params.msg params.nick = nick @@ -7,14 +12,14 @@ serverCommands.say = function (serverstate, settings, params) { return serverstate.clients.notifyAll('message', params) } -serverCommands.nick = function (serverstate, settings, params) { +serverCommands.nick = function (serverstate, settings, params, id) { var oldnick = settings.nick var newnick = params.nick settings.nick = newnick return serverstate.clients.notifyAll('nickchange', { nick: oldnick, newnick: newnick }); } -serverCommands.badcommand = function (serversate, settings, params) { +serverCommands.badcommand = function (serversate, settings, params, id) { settings.conn.write(JSON.stringify({ method: 'usererror', params: { message: 'bad command' }})) } -- cgit v1.2.3