Moved websocket handling on the client into its own file, added reason to part and quit messages, global system messages about a user now only gets sent to channels where the user is/was
This commit is contained in:
parent
3f335187c0
commit
736ef76bc0
9 changed files with 108 additions and 100 deletions
|
@ -6,7 +6,8 @@ var socket = require('../socket');
|
|||
var messageActions = Reflux.createActions([
|
||||
'send',
|
||||
'add',
|
||||
'broadcast'
|
||||
'broadcast',
|
||||
'inform'
|
||||
]);
|
||||
|
||||
messageActions.send.preEmit = function(message, to, server) {
|
||||
|
@ -17,48 +18,4 @@ messageActions.send.preEmit = function(message, to, server) {
|
|||
});
|
||||
};
|
||||
|
||||
socket.on('message', function(data) {
|
||||
messageActions.add(data);
|
||||
});
|
||||
|
||||
socket.on('pm', function(data) {
|
||||
messageActions.add(data);
|
||||
});
|
||||
|
||||
socket.on('join', function(data) {
|
||||
messageActions.add({
|
||||
server: data.server,
|
||||
to: data.channels[0],
|
||||
message: data.user + ' joined the channel',
|
||||
type: 'info'
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('part', function(data) {
|
||||
messageActions.add({
|
||||
server: data.server,
|
||||
to: data.channels[0],
|
||||
message: data.user + ' left the channel',
|
||||
type: 'info'
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('quit', function(data) {
|
||||
messageActions.broadcast(data.user + ' quit', data.server);
|
||||
});
|
||||
|
||||
socket.on('nick', function(data) {
|
||||
messageActions.broadcast(data.old + ' changed nick to ' + data.new, data.server);
|
||||
});
|
||||
|
||||
socket.on('motd', function(data) {
|
||||
_.each(data.content.split('\n'), function(line) {
|
||||
messageActions.add({
|
||||
server: data.server,
|
||||
to: data.server,
|
||||
message: line
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
module.exports = messageActions;
|
Loading…
Add table
Add a link
Reference in a new issue