Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var ignore_check = function(user)
- {
- return user.substring(0, 7) == 'tourist';
- }
- let ignore = function(data)
- {
- let user = null;
- if(typeof data.user == 'string'
- && data.user.length >= 1
- && data.user != 'none')
- {
- user = data.user;
- } else
- if(typeof data.msg == 'string'
- && data.msg.length >= 1)
- {
- let s = data.msg;
- let u = s.indexOf('<b');
- if(u != -1) u = s.indexOf('>', u);
- if(u != -1) ++u;
- let ue = s.indexOf('<', u);
- if(ue != -1) user = s.substring(u, ue);
- if(user)
- {
- console.log('parsed user==['+user+']');
- }
- }
- if(user !== null)
- {
- console.log('final user==['+user+']');
- if(ignore_check(user.toLowerCase()))
- {
- console.log('ignoring');
- return true;
- }
- }
- console.log('not ignoring');
- return false;
- };
- ['private', 'message'].forEach(function(cmd)
- {
- let cb = window.io(document.location.hostname+':8000')._callbacks
- ;
- let old = cb[cmd][0];
- cb[cmd][0] = function(data)
- {
- if(!ignore(data))
- {
- old(data);
- }
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement