Add /help, make /part take an optional channel param
This commit is contained in:
parent
ccb0149b3d
commit
b83efcbb9e
@ -1,3 +1,5 @@
|
|||||||
|
var _ = require('lodash');
|
||||||
|
|
||||||
var channelStore = require('./stores/channel');
|
var channelStore = require('./stores/channel');
|
||||||
var channelActions = require('./actions/channel');
|
var channelActions = require('./actions/channel');
|
||||||
var messageActions = require('./actions/message');
|
var messageActions = require('./actions/message');
|
||||||
@ -27,7 +29,9 @@ messageActions.command.listen(function(line, channel, server) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'part':
|
case 'part':
|
||||||
if (channel) {
|
if (params[1]) {
|
||||||
|
channelActions.part([params[1]], server);
|
||||||
|
} else if (channel) {
|
||||||
channelActions.part([channel], server);
|
channelActions.part([channel], server);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -88,5 +92,19 @@ messageActions.command.listen(function(line, channel, server) {
|
|||||||
case 'away':
|
case 'away':
|
||||||
serverActions.away(params[1], server);
|
serverActions.away(params[1], server);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'help':
|
||||||
|
messageActions.inform([
|
||||||
|
_.escape('/join <channel> - Join a channel'),
|
||||||
|
'/part [channel] - Leave the current or entered channel',
|
||||||
|
_.escape('/nick <nick> - Change nick'),
|
||||||
|
'/quit - Disconnect from the current server',
|
||||||
|
_.escape('/me <message> - Send action message'),
|
||||||
|
'/topic - Show topic for the current channel',
|
||||||
|
_.escape('/msg <target> <message> - Send message to the entered channel or user'),
|
||||||
|
_.escape('/say <message> - Send message to the current chat'),
|
||||||
|
'/away [message] - Set or clear away message'
|
||||||
|
], server, channel);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
});
|
});
|
@ -59,12 +59,14 @@ socket.on('mode', function(data) {
|
|||||||
socket.on('whois', function(data) {
|
socket.on('whois', function(data) {
|
||||||
var tab = selectedTabStore.getState();
|
var tab = selectedTabStore.getState();
|
||||||
|
|
||||||
messageActions.inform('Nick: ' + data.nick, tab.server, tab.channel);
|
messageActions.inform([
|
||||||
messageActions.inform('Username: ' + data.username, tab.server, tab.channel);
|
'Nick: ' + data.nick,
|
||||||
messageActions.inform('Realname: ' + data.realname, tab.server, tab.channel);
|
'Username: ' + data.username,
|
||||||
messageActions.inform('Host: ' + data.host, tab.server, tab.channel);
|
'Realname: ' + data.realname,
|
||||||
messageActions.inform('Server: ' + data.server, tab.server, tab.channel);
|
'Host: ' + data.host,
|
||||||
messageActions.inform('Channels: ' + data.channels, tab.server, tab.channel);
|
'Server: ' + data.server,
|
||||||
|
'Channels: ' + data.channels
|
||||||
|
], tab.server, tab.channel);
|
||||||
});
|
});
|
||||||
|
|
||||||
socket.on('servers', function(data) {
|
socket.on('servers', function(data) {
|
||||||
|
@ -72,12 +72,24 @@ var messageStore = Reflux.createStore({
|
|||||||
},
|
},
|
||||||
|
|
||||||
inform: function(message, server, channel) {
|
inform: function(message, server, channel) {
|
||||||
|
if (_.isArray(message)) {
|
||||||
|
_.each(message, (msg) => {
|
||||||
|
addMessage({
|
||||||
|
server: server,
|
||||||
|
to: channel,
|
||||||
|
message: msg,
|
||||||
|
type: 'info'
|
||||||
|
}, channel || server);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
addMessage({
|
addMessage({
|
||||||
server: server,
|
server: server,
|
||||||
to: channel,
|
to: channel,
|
||||||
message: message,
|
message: message,
|
||||||
type: 'info'
|
type: 'info'
|
||||||
}, channel || server);
|
}, channel || server);
|
||||||
|
}
|
||||||
|
|
||||||
this.trigger(messages);
|
this.trigger(messages);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user