Merge pull request #209 from wizardfrag/actions

Fix issue #208 and an issue where the word ACTION in a /me can be stripped
This commit is contained in:
Mattias Erming 2014-10-02 19:20:58 +02:00
commit 61eb300393

View File

@ -5,7 +5,7 @@ var Msg = require("../../models/msg");
module.exports = function(irc, network) { module.exports = function(irc, network) {
var client = this; var client = this;
irc.on("message", function(data) { irc.on("message", function(data) {
if (data.message.indexOf("\001") === 0) { if (data.message.indexOf("\u0001") === 0 && data.message.substring(0, 7) != "\u0001ACTION") {
// Hide ctcp messages. // Hide ctcp messages.
return; return;
} }
@ -32,7 +32,7 @@ module.exports = function(irc, network) {
var text = data.message; var text = data.message;
if (text.split(" ")[0] === "\u0001ACTION") { if (text.split(" ")[0] === "\u0001ACTION") {
type = Msg.Type.ACTION; type = Msg.Type.ACTION;
text = text.replace(/\u0001|ACTION/g, ""); text = text.replace(/^\u0001ACTION|\u0001$/g, "");
} }
text.split(" ").forEach(function(w) { text.split(" ").forEach(function(w) {