<commit_before>// Name  : message.js
// Author: <NAME>
//
// Description:
//   Functionality to propagate messages from a socket to all other sockets.

/////////////
// Imports //
var helper = require('../helper.js');

//////////
// Code //

// Directing and propagating incoming messages.
function message(io, socket) {
    return function (msg) {
        var validation = helper.getValidation(socket.id);
        if (!msg.auth || validation === undefined) {
            socket.emit('message', helper.serverMessage({
                channel: 'main',
                text   : 'You must be logged in to send chat messages.'
            }));

            return;
        }

        io.to(msg.channel).emit('message', {
            channel : msg.channel,
            username: validation.username,
            picture : validation.picture ? validation.picture : 'blank_user_profile.jpg',
            text    : msg.text,
            time    : msg.time
        });
    };
}

/////////////
// Exports //
module.exports.message = message;<commit_msg>Fixed a bug to not being logged in.<commit_after>// Name  : message.js
// Author: <NAME>
//
// Description:
//   Functionality to propagate messages from a socket to all other sockets.

/////////////
// Imports //
var helper = require('../helper.js');

//////////
// Code //

// Directing and propagating incoming messages.
function message(io, socket) {
    return function (msg) {
        var validation = helper.getValidation(socket.id);
        if (!msg.auth || validation === undefined) {
            socket.emit('message', helper.serverMessage('You must be logged in to send chat messages.'));
            return;
        }

        io.to(msg.channel).emit('message', {
            channel : msg.channel,
            username: validation.username,
            picture : validation.picture ? validation.picture : 'blank_user_profile.jpg',
            text    : msg.text,
            time    : msg.time
        });
    };
}

/////////////
// Exports //
module.exports.message = message;
{'fraction_non_alphanumeric': 0.1603541564190851, 'fraction_numerical': 0.0, 'mean_word_length': 1.8093922651933703, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '793821', 'n_tokens_mistral': 532, 'n_tokens_neox': 520, 'n_words': 144}