Built motion from commit (unavailable).|2.4.4
[motion2.git] / server / config / utils.js
index eead57f..bfbf281 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe95f=['catch','lodash','bluebird','../mysqldb','voice','chat','fax','sms','openchannel','getChannels','isValidChannel','clearBlockUser','isUndefined','blockedAt','updateAttributes','role','User','count','agent','then','agents','Maximum\x20login\x20has\x20been\x20reached'];(function(_0x53e814,_0x43c105){var _0x4f4b67=function(_0x362b02){while(--_0x362b02){_0x53e814['push'](_0x53e814['shift']());}};_0x4f4b67(++_0x43c105);}(_0xe95f,0x135));var _0xfe95=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe95f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xfe95('0x0'));var BPromise=require(_0xfe95('0x1'));var db=require(_0xfe95('0x2'))['db'];var util=require('./license/util');var channels=[_0xfe95('0x3'),'mail',_0xfe95('0x4'),_0xfe95('0x5'),_0xfe95('0x6'),_0xfe95('0x7')];exports[_0xfe95('0x8')]=function(){return channels;};exports[_0xfe95('0x9')]=function(_0x370449){_0x370449=_0x370449['toLowerCase']();return _['includes'](channels,_0x370449);};exports[_0xfe95('0xa')]=function(_0x4fb478,_0x56d802,_0x5123a8,_0x5b94b6){var _0x562f07={'loginAttempts':_0x56d802,'blocked':_0x5123a8};if(!_[_0xfe95('0xb')](_0x5b94b6)){_0x562f07[_0xfe95('0xc')]=_0x5b94b6;}return _0x4fb478[_0xfe95('0xd')](_0x562f07);};exports['getLicense']=function(_0x441ba1){return new BPromise(function(_0x193c8a,_0x51fff6){var _0x48b2aa=0x0;if(_0x441ba1[_0xfe95('0xe')]!=='agent'){_0x193c8a(_0x441ba1);}db[_0xfe95('0xf')][_0xfe95('0x10')]({'where':{'role':_0xfe95('0x11'),'online':!![],'id':{'$ne':_0x441ba1['id']}}})[_0xfe95('0x12')](function(_0x557e7f){_0x48b2aa=_0x557e7f;return util['getLicense']();})[_0xfe95('0x12')](function(_0x2c835f){if(_0x2c835f&&_0x2c835f['agents']&&_0x48b2aa>=_0x2c835f[_0xfe95('0x13')]){throw Error(_0xfe95('0x14'));}_0x193c8a(_0x441ba1);})[_0xfe95('0x15')](function(_0x31636e){_0x51fff6(_0x31636e);});});};
\ No newline at end of file
+var _0xdc92=['getLicense','role','agent','User','count','agents','lodash','bluebird','../mysqldb','./license/util','voice','mail','fax','sms','openchannel','getChannels','toLowerCase','includes','updateAttributes'];(function(_0x41f8ba,_0x55c7bb){var _0x52cf8b=function(_0x55e59c){while(--_0x55e59c){_0x41f8ba['push'](_0x41f8ba['shift']());}};_0x52cf8b(++_0x55c7bb);}(_0xdc92,0xfd));var _0x2dc9=function(_0xc5a279,_0x155360){_0xc5a279=_0xc5a279-0x0;var _0xc755d3=_0xdc92[_0xc5a279];return _0xc755d3;};'use strict';var _=require(_0x2dc9('0x0'));var BPromise=require(_0x2dc9('0x1'));var db=require(_0x2dc9('0x2'))['db'];var util=require(_0x2dc9('0x3'));var channels=[_0x2dc9('0x4'),_0x2dc9('0x5'),'chat',_0x2dc9('0x6'),_0x2dc9('0x7'),_0x2dc9('0x8')];exports[_0x2dc9('0x9')]=function(){return channels;};exports['isValidChannel']=function(_0x26f41c){_0x26f41c=_0x26f41c[_0x2dc9('0xa')]();return _[_0x2dc9('0xb')](channels,_0x26f41c);};exports['clearBlockUser']=function(_0x49e28f,_0x59cece,_0x3ce931,_0x5c4985){var _0x58bb77={'loginAttempts':_0x59cece,'blocked':_0x3ce931};if(!_['isUndefined'](_0x5c4985)){_0x58bb77['blockedAt']=_0x5c4985;}return _0x49e28f[_0x2dc9('0xc')](_0x58bb77);};exports[_0x2dc9('0xd')]=function(_0x5f5b86){return new BPromise(function(_0x370fc2,_0x19fade){var _0x399439=0x0;if(_0x5f5b86[_0x2dc9('0xe')]!==_0x2dc9('0xf')){_0x370fc2(_0x5f5b86);}db[_0x2dc9('0x10')][_0x2dc9('0x11')]({'where':{'role':_0x2dc9('0xf'),'online':!![],'id':{'$ne':_0x5f5b86['id']}}})['then'](function(_0x21d8a5){_0x399439=_0x21d8a5;return util['getLicense']();})['then'](function(_0x4d3d6f){if(_0x4d3d6f&&_0x4d3d6f['agents']&&_0x399439>=_0x4d3d6f[_0x2dc9('0x12')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x370fc2(_0x5f5b86);})['catch'](function(_0x725497){_0x19fade(_0x725497);});});};
\ No newline at end of file