diff --git a/server/handlers/functions.js b/server/handlers/functions.js index 8f62e814..001d8f14 100644 --- a/server/handlers/functions.js +++ b/server/handlers/functions.js @@ -126,7 +126,6 @@ function check_inlist(coll, guid, socket, offline, callback, double_check) if(typeof(callback) == "function") callback(); return; } - console.log(coll, double_check); //coll = coll.replace(/ /g,''); if(!offline && coll != undefined){ 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) { - console.log(coll, guid, short_id, in_list, change); +function left_channel(coll, guid, short_id, in_list, socket, change, caller) { if(!coll) { if(!change) { remove_name_from_db(guid, coll); diff --git a/server/handlers/io.js b/server/handlers/io.js index 6a6d04c2..90de1d00 100644 --- a/server/handlers/io.js +++ b/server/handlers/io.js @@ -134,6 +134,7 @@ module.exports = function() { socket.on("error_video", function(msg) { try { + msg.channel = Functions.encodeChannelName(msg.channel); var _list = msg.channel;//.replace(/ /g,''); if(_list.length == 0) return; if(_list.indexOf("?") > -1){ @@ -142,7 +143,7 @@ module.exports = function() { } coll = Functions.removeEmojis(_list).toLowerCase(); //coll = coll.replace(/_/g, ""); - msg.channel = Functions.encodeChannelName(msg.channel); + //coll = filter.clean(coll); } catch(e) { return; @@ -418,7 +419,6 @@ module.exports = function() { var _list = obj.channel.substring(0, obj.channel.indexOf("?")); obj.channel = _list; } - console.log("end object", obj); if(obj.hasOwnProperty("channel")) { obj.channel = Functions.encodeChannelName(obj.channel); try { @@ -553,6 +553,7 @@ module.exports = function() { } if(conf.hasOwnProperty("channel")) { conf.channel = Functions.encodeChannelName(conf.channel); + coll = conf.channel; } //if(coll != undefined) coll.replace(/ /g,''); ListSettings.conf_function(conf, coll, guid, offline, socket); @@ -567,18 +568,17 @@ module.exports = function() { if(msg.hasOwnProperty("channel")) { msg.channel = Functions.encodeChannelName(msg.channel); } - if(coll !== undefined) { - try { - coll = msg.channel.toLowerCase();//.replace(/ /g,''); - if(coll.length == 0) return; - coll = Functions.removeEmojis(coll).toLowerCase(); - //coll = coll.replace(/_/g, ""); + try { + coll = msg.channel.toLowerCase();//.replace(/ /g,''); + if(coll.length == 0) return; + coll = Functions.removeEmojis(coll).toLowerCase(); + //coll = coll.replace(/_/g, ""); - //coll = filter.clean(coll); - } catch(e) { - return; - } + //coll = filter.clean(coll); + } catch(e) { + return; } + ListChange.shuffle(msg, coll, guid, offline, socket); }); @@ -609,18 +609,18 @@ module.exports = function() { 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; }); 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() { - 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) { @@ -635,23 +635,23 @@ module.exports = function() { coll = msg.channel;//.replace(/ /g,''); coll = Functions.removeEmojis(coll).toLowerCase(); //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() { - 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() { - 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() { - 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)