From bf695e6ad13b0fd0fb2706d6bf9960a66e656696 Mon Sep 17 00:00:00 2001 From: Joe Robinson Date: Sun, 16 Oct 2016 21:22:31 +0100 Subject: Add mode handler --- handlers.js | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/handlers.js b/handlers.js index e68a14d..c6d86de 100644 --- a/handlers.js +++ b/handlers.js @@ -136,6 +136,43 @@ module.exports.handleCommands = function(myClient) { }); }) + client.on('mode', function(event) { + var chatTab = $("[data-tab='"+ channel +"'].chat"); + var by = event.nick + var channel = event.target + event.modes.forEach(function (modeObj) { + + var mode = modeObj.mode + var argument = modeObj.param + if (mode == "+o") { + modeLine = " gives channel operator status to " + argument; + } else if (mode == "+v") { + modeLine = " gives voice to " + argument; + } else if (mode == "+h") { + modeLine = " gives channel half-operator status to " + argument; + } else if (mode == "+q") { + modeLine = " gives channel owner status to " + argument; + } else if (mode == "-o") { + modeLine = " removes channel operator status from " + argument; + } else if (mode == "-v") { + modeLine = " removes voice from "; + } else if (mode == "-h") { + modeLine = " removes channel half-operator status from " + argument; + } else if (mode == "-q") { + modeLine = " removes channel owner status from " + argument; + } else if (argument == myNick) { + modeLine = " sets mode " + mode + " on " + argument; + } else if (argument != null) { + modeLine = " sets mode " + mode + " " + argument + " on " +channel; + } else { + modeLine = " sets mode "+mode+" on " +channel + } + var chatTab = $("[data-tab='"+ channel +"'].chat"); + chatTab.append("

"+by+modeLine+"

"); + }) + chatTab.scrollTop(chatTab.prop("scrollHeight")); + }) + } function receiveMsg(target, from, message) { -- cgit v1.2.3