diff --git a/packages/cory/chat/chat.js b/packages/cory/chat/chat.js index 6e62fb78e..7d77a3d55 100644 --- a/packages/cory/chat/chat.js +++ b/packages/cory/chat/chat.js @@ -169,7 +169,6 @@ function connect(id) { break; } } - print(id, account); if (account) { let self = {account: account}; @@ -431,14 +430,23 @@ function printMessage(message) { var now = message.timestamp || new Date().toString(); var from = message.from || "unknown"; - terminal.print( - {class: "base0", value: niceTime(lastTimestamp, now)}, - " ", - {class: "base00", value: "<"}, - {class: "base3", value: from}, - {class: "base00", value: ">"}, - " ", - formatMessage(message.message)); + if (message.action) { + terminal.print( + {class: "base0", value: niceTime(lastTimestamp, now)}, + " * ", + {class: "base3", value: from}, + " ", + formatMessage(message.message)); + } else { + terminal.print( + {class: "base0", value: niceTime(lastTimestamp, now)}, + " ", + {class: "base00", value: "<"}, + {class: "base3", value: from}, + {class: "base00", value: ">"}, + " ", + formatMessage(message.message)); + } lastTimestamp = now; } diff --git a/packages/cory/libirc/libirc.js b/packages/cory/libirc/libirc.js index f478ef3d5..8a765a03b 100644 --- a/packages/cory/libirc/libirc.js +++ b/packages/cory/libirc/libirc.js @@ -73,11 +73,19 @@ class IrcService { } else if (prefix.indexOf('!') != -1) { conversation = prefix.split('!')[0]; } - this._service.notifyMessageReceived(conversation, { + let message = { from: prefix.split('!')[0], message: parts[parts.length - 1], type: parts[0], - }); + }; + if (message.message.length > 2 && message.message.charCodeAt(0) == 1 && message.message.charCodeAt(message.message.length - 1) == 1) { + message.ctcp = true; + if (message.message.substring(1, 1 + "ACTION ".length) == "ACTION ") { + message.action = true; + message.message = message.message.substring(1 + "ACTION ".length, message.message.length - 1); + } + } + this._service.notifyMessageReceived(conversation, message); } else if (parts[0] == "PING") { parts[0] = "PONG"; this._send(parts.join(" "));