diff --git a/client/src/js/components/MessageBox.jsx b/client/src/js/components/MessageBox.jsx index cffcde99..eafa6b95 100644 --- a/client/src/js/components/MessageBox.jsx +++ b/client/src/js/components/MessageBox.jsx @@ -40,10 +40,8 @@ var MessageBox = React.createClass({ messages = _.map(this.state.messages[tab.server][dest], function(message) { var messageClass = 'message'; - switch (message.type) { - case 'info': - messageClass += ' message-info'; - break; + if (message.type) { + messageClass += ' message-' + message.type; } return ( diff --git a/client/src/js/components/MessageInput.jsx b/client/src/js/components/MessageInput.jsx index 3e75f2f9..e5479bd1 100644 --- a/client/src/js/components/MessageInput.jsx +++ b/client/src/js/components/MessageInput.jsx @@ -22,6 +22,12 @@ function dispatchCommand(cmd, channel, server) { channelActions.part([channel], server); } break; + + case 'me': + if (params.length > 1) { + messageActions.send('\x01ACTION ' + params.slice(1).join(' ') + '\x01', channel, server); + } + break; } } diff --git a/client/src/js/stores/message.js b/client/src/js/stores/message.js index 5297d9a5..ec502929 100644 --- a/client/src/js/stores/message.js +++ b/client/src/js/stores/message.js @@ -10,6 +10,13 @@ var messages = {}; function addMessage(message, dest) { message.time = new Date(); + if (message.message.indexOf('\x01ACTION') === 0) { + var from = message.from; + message.from = null; + message.type = 'action'; + message.message = from + message.message.slice(7); + } + if (!(message.server in messages)) { messages[message.server] = {}; messages[message.server][dest] = [message]; diff --git a/client/src/style.css b/client/src/style.css index 5c945cc6..58a857a8 100644 --- a/client/src/style.css +++ b/client/src/style.css @@ -209,6 +209,10 @@ p { color: #999; } +.message-action { + color: #6BB758; +} + .message-time { color: #999; }