Added support for IRC actions

This commit is contained in:
khlieng 2015-02-04 00:55:41 +01:00
parent d69281cdd6
commit ad4354adfc
4 changed files with 19 additions and 4 deletions

View File

@ -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 (

View File

@ -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;
}
}

View File

@ -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];

View File

@ -209,6 +209,10 @@ p {
color: #999;
}
.message-action {
color: #6BB758;
}
.message-time {
color: #999;
}