mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 10:37:34 +00:00
Adds NETWORK_LOG_FILTER setting to incoming network messages
This commit is contained in:
parent
fc7866f11e
commit
a5f828a861
1 changed files with 25 additions and 18 deletions
|
|
@ -25,13 +25,25 @@ function (ProtocolHelper, GameController, User, Nc, Settings, DomController) {
|
||||||
var self = this;
|
var self = this;
|
||||||
this.socketLink.on('message', function (message) {
|
this.socketLink.on('message', function (message) {
|
||||||
var m = JSON.parse(message)
|
var m = JSON.parse(message)
|
||||||
if(Settings.NETWORK_LOG_INCOMING) {
|
|
||||||
|
|
||||||
if (message.indexOf('worldUpdate') == -1 && message.indexOf('pong') == -1) {
|
if(Settings.NETWORK_LOG_INCOMING) {
|
||||||
|
var shouldBeFiltered = false;
|
||||||
|
var keyword;
|
||||||
|
|
||||||
|
for (var i = 0; i < Settings.NETWORK_LOG_FILTER.length; i++) {
|
||||||
|
keyword = Settings.NETWORK_LOG_FILTER[i];
|
||||||
|
if(message.search(keyword) != -1) {
|
||||||
|
shouldBeFiltered = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if(!shouldBeFiltered) {
|
||||||
console.log('INCOMING', message);
|
console.log('INCOMING', message);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ProtocolHelper.applyCommand(message, self);
|
ProtocolHelper.applyCommand(message, self);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -117,23 +129,18 @@ function (ProtocolHelper, GameController, User, Nc, Settings, DomController) {
|
||||||
this.socketLink.send(message);
|
this.socketLink.send(message);
|
||||||
|
|
||||||
if(Settings.NETWORK_LOG_OUTGOING) {
|
if(Settings.NETWORK_LOG_OUTGOING) {
|
||||||
if(Settings.NETWORK_LOG_FILTER.length > 0) {
|
var shouldBeFiltered = false;
|
||||||
|
var keyword;
|
||||||
|
|
||||||
var shouldBeFiltered = false;
|
for (var i = 0; i < Settings.NETWORK_LOG_FILTER.length; i++) {
|
||||||
var keyword;
|
keyword = Settings.NETWORK_LOG_FILTER[i];
|
||||||
|
if(message.search(keyword) != -1) {
|
||||||
for (var i = 0; i < Settings.NETWORK_LOG_FILTER.length; i++) {
|
shouldBeFiltered = true;
|
||||||
keyword = Settings.NETWORK_LOG_FILTER[i];
|
break;
|
||||||
if(message.search(keyword) != -1) {
|
|
||||||
shouldBeFiltered = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
if(!shouldBeFiltered) {
|
|
||||||
console.log('OUTGOING', message);
|
|
||||||
}
|
}
|
||||||
} else {
|
};
|
||||||
|
|
||||||
|
if(!shouldBeFiltered) {
|
||||||
console.log('OUTGOING', message);
|
console.log('OUTGOING', message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue