From 5a3b07a69864c1e31fa567731906531015d393c7 Mon Sep 17 00:00:00 2001 From: Maxime Poulin Date: Tue, 10 May 2016 21:19:09 -0400 Subject: [PATCH] Fix sending messages starting with a space There really is no need to trim apart bringing more situations like this. If I want to put spaces in front of my message (say, for alignment purposes), then I should be able to. Fixes #319 --- src/client.js | 2 +- src/plugins/inputs/msg.js | 16 ++++------------ 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/src/client.js b/src/client.js index 90513ea6..3fa443bf 100644 --- a/src/client.js +++ b/src/client.js @@ -267,7 +267,7 @@ Client.prototype.setPassword = function(hash) { Client.prototype.input = function(data) { var client = this; - var text = data.text.trim(); + var text = data.text; var target = client.find(data.target); // This is either a normal message or a command escaped with a leading '/' diff --git a/src/plugins/inputs/msg.js b/src/plugins/inputs/msg.js index 5fb0dd14..2d765346 100644 --- a/src/plugins/inputs/msg.js +++ b/src/plugins/inputs/msg.js @@ -1,19 +1,11 @@ exports.commands = ["msg", "say"]; exports.input = function(network, chan, cmd, args) { - if (args.length === 0 || args[0] === "") { - return true; - } - var irc = network.irc; - var target = ""; - if (cmd === "msg") { - target = args.shift(); - if (args.length === 0) { - return true; - } - } else { - target = chan.name; + var target = cmd === "msg" ? args.shift() : chan.name; + + if (args.length === 0 || !target) { + return true; } var msg = args.join(" ");