removing duplicate regexp

This commit is contained in:
Rodolphe Breard 2012-12-18 17:17:20 +01:00
parent 4cf241970a
commit 1e089bf972

View file

@ -32,16 +32,19 @@ var NsClient = function() {
})(this);
this.actions.msg = {};
this.actions.msg.is = function(msg) {
var exp = /user_cmd (\d+):user:.*?:(.*?)@(.*?):.*?:(.*?):(.*?) \| msg ([^ ]*)/;
this.actions.msg.exp = /user_cmd (\d+):user:.*?:(.*?)@(.*?):.*?:(.*?):(.*?) \| msg ([^ ]*)/;
this.actions.msg.is = (function(exp) {
return function(msg) {
console.log(exp);
return exp.exec(msg) !== null;
};
})(this.actions.msg.exp);
this.actions.msg.act = (function(elem) {
return function(msg) {
if ($cs.opts.get("enable_msg")) {
var mo = {}, exp = /user_cmd (\d+):user:.*?:(.*?)@(.*?):.*?:(.*?):(.*?) \| msg ([^ ]*)/;
var mo = {};
mch = exp.exec(msg);
mch = elem.actions.msg.exp.exec(msg);
if (mch !== null && typeof elem.msgHandler !== "undefined") {
mo.socket = mch[1];
mo.login = mch[2];