Removed logging after finding issue with channels and leaves

This commit is contained in:
Kasper Rynning-Tønnesen
2018-09-26 20:09:54 +02:00
parent f19992060e
commit 7ab5d4f399
2 changed files with 20 additions and 22 deletions

View File

@@ -126,7 +126,6 @@ function check_inlist(coll, guid, socket, offline, callback, double_check)
if(typeof(callback) == "function") callback(); if(typeof(callback) == "function") callback();
return; return;
} }
console.log(coll, double_check);
//coll = coll.replace(/ /g,''); //coll = coll.replace(/ /g,'');
if(!offline && coll != undefined){ if(!offline && coll != undefined){
db.collection("connected_users").update({"_id": coll}, {$addToSet:{users: guid}}, {upsert: true}, function(err, updated) { db.collection("connected_users").update({"_id": coll}, {$addToSet:{users: guid}}, {upsert: true}, function(err, updated) {
@@ -385,8 +384,7 @@ function remove_from_chat_channel(coll, guid) {
}); });
} }
function left_channel(coll, guid, short_id, in_list, socket, change) { function left_channel(coll, guid, short_id, in_list, socket, change, caller) {
console.log(coll, guid, short_id, in_list, change);
if(!coll) { if(!coll) {
if(!change) { if(!change) {
remove_name_from_db(guid, coll); remove_name_from_db(guid, coll);

View File

@@ -134,6 +134,7 @@ module.exports = function() {
socket.on("error_video", function(msg) { socket.on("error_video", function(msg) {
try { try {
msg.channel = Functions.encodeChannelName(msg.channel);
var _list = msg.channel;//.replace(/ /g,''); var _list = msg.channel;//.replace(/ /g,'');
if(_list.length == 0) return; if(_list.length == 0) return;
if(_list.indexOf("?") > -1){ if(_list.indexOf("?") > -1){
@@ -142,7 +143,7 @@ module.exports = function() {
} }
coll = Functions.removeEmojis(_list).toLowerCase(); coll = Functions.removeEmojis(_list).toLowerCase();
//coll = coll.replace(/_/g, ""); //coll = coll.replace(/_/g, "");
msg.channel = Functions.encodeChannelName(msg.channel);
//coll = filter.clean(coll); //coll = filter.clean(coll);
} catch(e) { } catch(e) {
return; return;
@@ -418,7 +419,6 @@ module.exports = function() {
var _list = obj.channel.substring(0, obj.channel.indexOf("?")); var _list = obj.channel.substring(0, obj.channel.indexOf("?"));
obj.channel = _list; obj.channel = _list;
} }
console.log("end object", obj);
if(obj.hasOwnProperty("channel")) { if(obj.hasOwnProperty("channel")) {
obj.channel = Functions.encodeChannelName(obj.channel); obj.channel = Functions.encodeChannelName(obj.channel);
try { try {
@@ -553,6 +553,7 @@ module.exports = function() {
} }
if(conf.hasOwnProperty("channel")) { if(conf.hasOwnProperty("channel")) {
conf.channel = Functions.encodeChannelName(conf.channel); conf.channel = Functions.encodeChannelName(conf.channel);
coll = conf.channel;
} }
//if(coll != undefined) coll.replace(/ /g,''); //if(coll != undefined) coll.replace(/ /g,'');
ListSettings.conf_function(conf, coll, guid, offline, socket); ListSettings.conf_function(conf, coll, guid, offline, socket);
@@ -567,18 +568,17 @@ module.exports = function() {
if(msg.hasOwnProperty("channel")) { if(msg.hasOwnProperty("channel")) {
msg.channel = Functions.encodeChannelName(msg.channel); msg.channel = Functions.encodeChannelName(msg.channel);
} }
if(coll !== undefined) { try {
try { coll = msg.channel.toLowerCase();//.replace(/ /g,'');
coll = msg.channel.toLowerCase();//.replace(/ /g,''); if(coll.length == 0) return;
if(coll.length == 0) return; coll = Functions.removeEmojis(coll).toLowerCase();
coll = Functions.removeEmojis(coll).toLowerCase(); //coll = coll.replace(/_/g, "");
//coll = coll.replace(/_/g, "");
//coll = filter.clean(coll); //coll = filter.clean(coll);
} catch(e) { } catch(e) {
return; return;
}
} }
ListChange.shuffle(msg, coll, guid, offline, socket); ListChange.shuffle(msg, coll, guid, offline, socket);
}); });
@@ -609,18 +609,18 @@ module.exports = function() {
return; return;
} }
} }
Functions.left_channel(coll, guid, short_id, in_list, socket, true); Functions.left_channel(coll, guid, short_id, in_list, socket, true, "left 1");
in_list = false; in_list = false;
}); });
socket.on('disconnect', function() socket.on('disconnect', function()
{ {
Functions.left_channel(coll, guid, short_id, in_list, socket, false); Functions.left_channel(coll, guid, short_id, in_list, socket, false, "left 2");
}); });
socket.on('disconnected', function() socket.on('disconnected', function()
{ {
Functions.left_channel(coll, guid, short_id, in_list, socket, false); Functions.left_channel(coll, guid, short_id, in_list, socket, false, "left 3");
}); });
socket.on("left_channel", function(msg) { socket.on("left_channel", function(msg) {
@@ -635,23 +635,23 @@ module.exports = function() {
coll = msg.channel;//.replace(/ /g,''); coll = msg.channel;//.replace(/ /g,'');
coll = Functions.removeEmojis(coll).toLowerCase(); coll = Functions.removeEmojis(coll).toLowerCase();
//coll = filter.clean(coll); //coll = filter.clean(coll);
Functions.left_channel(coll, guid, short_id, in_list, socket, false); Functions.left_channel(coll, guid, short_id, in_list, socket, false, "left 4");
} }
}) })
socket.on('reconnect_failed', function() socket.on('reconnect_failed', function()
{ {
Functions.left_channel(coll, guid, short_id, in_list, socket, false); Functions.left_channel(coll, guid, short_id, in_list, socket, false, "left 5");
}); });
socket.on('connect_timeout', function() socket.on('connect_timeout', function()
{ {
Functions.left_channel(coll, guid, short_id, in_list, socket, false); Functions.left_channel(coll, guid, short_id, in_list, socket, false, "left 6");
}); });
socket.on('error', function() socket.on('error', function()
{ {
Functions.left_channel(coll, guid, short_id, in_list, socket, false); Functions.left_channel(coll, guid, short_id, in_list, socket, false, "left 7");
}); });
socket.on('pos', function(obj) socket.on('pos', function(obj)