From 39b2af52c5456e2a420b19ab5227acc1fea36504 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 90513ea68d..3fa443bf08 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 5fb0dd1488..2d7653467d 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(" ");