Skip to content

Commit

Permalink
Merge pull request #345 from maxpoulin64/no-blank
Browse files Browse the repository at this point in the history
Don't send completely empty messages
  • Loading branch information
AlMcKinlay committed May 25, 2016
2 parents 7834d12 + 21eafef commit 1146557
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
7 changes: 7 additions & 0 deletions client/js/lounge.js
Original file line number Diff line number Diff line change
Expand Up @@ -604,11 +604,18 @@ $(function() {
form.on("submit", function(e) {
e.preventDefault();
var text = input.val();

if (text.length === 0) {
return;
}

input.val("");

if (text.indexOf("/clear") === 0) {
clear();
return;
}

socket.emit("input", {
target: chat.data("id"),
text: text
Expand Down
5 changes: 5 additions & 0 deletions src/plugins/inputs/msg.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ exports.input = function(network, chan, cmd, args) {
}

var msg = args.join(" ");

if (msg.length === 0) {
return true;
}

irc.say(target, msg);

if (!network.irc.network.cap.isEnabled("echo-message")) {
Expand Down

0 comments on commit 1146557

Please sign in to comment.