Skip to content

Commit

Permalink
v0.22.0 - Fix minor stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
igorantun committed May 27, 2015
1 parent bc290b1 commit c8ebfb0
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,8 @@ function handleSocket(user, message) {
if(data.role == 1) role = 'Helper';
if(data.role == 2) role = 'Moderator';
if(data.role == 3) role = 'Administrator';
data.message = data.user + ' set ' + data.message + ' role to ' + role;
data.message = data.user + ' set ' + data.message + '\'s role to ' + role;

sendToOne(data, JSON.parse(message).message, 'role');
sendToAll({type:'server', info:'clients', clients:users});
} else {
Expand Down Expand Up @@ -402,7 +403,7 @@ function readLine() {

var server;

if (!config.ssl){
if(!config.ssl) {
var http = require('http');
server = http.createServer(app);
} else {
Expand All @@ -411,6 +412,7 @@ if (!config.ssl){
key: config.key,
cert: config.cert
};

server = https.createServer(opt, app);
}

Expand All @@ -421,38 +423,35 @@ server.on('listening', onListening);
function normalizePort(val) {
var port = parseInt(val, 10);

if (isNaN(port)) {
// named pipe
if(isNaN(port)) {
return val;
}

if (port >= 0) {
// port number
if(port >= 0) {
return port;
}

return false;
}

function onError(error) {
if (error.syscall !== 'listen') {
if(error.syscall !== 'listen') {
throw error;
}

var bind = typeof port === 'string'
? 'Pipe ' + port
: 'Port ' + port;
var bind = typeof port === 'string' ? 'Pipe ' + port : 'Port ' + port;

// handle specific listen errors with friendly messages
switch (error.code) {
case 'EACCES':
console.error(bind + ' requires elevated privileges');
process.exit(1);
break;

case 'EADDRINUSE':
console.error(bind + ' is already in use');
process.exit(1);
break;

default:
throw error;
}
Expand All @@ -466,4 +465,4 @@ function onListening() {
consoleLog(logStart, 'Listening at '+bind);
}

chat.installHandlers(server, {prefix:'/socket',log:function(){}});
chat.installHandlers(server, {prefix:'/socket', log:function(){}});

0 comments on commit c8ebfb0

Please sign in to comment.