From 6fa95e08dd92fdcc2740007e127fc6c5c14e24f2 Mon Sep 17 00:00:00 2001 From: Mattias Erming Date: Fri, 14 Mar 2014 17:52:24 +0100 Subject: [PATCH] Added /op, /deop, /voice and /devoice --- lib/server.js | 40 +++++++++++++++++++++++++++++++++++----- 1 file changed, 35 insertions(+), 5 deletions(-) diff --git a/lib/server.js b/lib/server.js index 0475c98..f35004c 100644 --- a/lib/server.js +++ b/lib/server.js @@ -185,6 +185,41 @@ function handleInput(input) { } break; + case "OP": + case "DEOP": + case "VOICE": + case "DEVOICE": + case "MODE": + var irc = network.irc; + if (!argv[1] && typeof irc === "undefined") { + break; + } + + var mode; + var user; + if (cmd != "MODE") { + user = argv[1]; + mode = { + "OP": "+o", + "DEOP": "-o", + "VOICE": "+v", + "DEVOICE": "-v" + }[cmd]; + } else if (!argv[2]) { + break; + } else { + mode = argv[1]; + user = argv[2]; + } + + irc.send( + "MODE", + target.channel.get("name"), + mode, + user + ); + break; + // This command is used for debugging purposes. // Send raw commands. case "SEND": @@ -271,11 +306,6 @@ function handleEvent(argv) { name: argv.nick }) ); - } else { - var irc = network.irc; - if (typeof irc !== "undefined") { - irc.send("TOPIC", argv.args[0]); - } } messages.add(