Built motion from commit a679711e.|2.6.15
[motion2.git] / server / config / utils.js
index 8a8423c..37e176d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x87e2=['then','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','bluebird','voice','mail','chat','fax','sms','whatsapp','openchannel','getChannels','isValidChannel','toLowerCase','includes','clearBlockUser','blockedAt','updateAttributes','role','User','count'];(function(_0x400672,_0x243a7e){var _0x27ed65=function(_0x350ca9){while(--_0x350ca9){_0x400672['push'](_0x400672['shift']());}};_0x27ed65(++_0x243a7e);}(_0x87e2,0x16d));var _0x287e=function(_0x360a5a,_0x566250){_0x360a5a=_0x360a5a-0x0;var _0x3e3f36=_0x87e2[_0x360a5a];return _0x3e3f36;};'use strict';var _=require(_0x287e('0x0'));var BPromise=require(_0x287e('0x1'));var db=require('../mysqldb')['db'];var util=require('./license/util');var channels=[_0x287e('0x2'),_0x287e('0x3'),_0x287e('0x4'),_0x287e('0x5'),_0x287e('0x6'),_0x287e('0x7'),_0x287e('0x8')];exports[_0x287e('0x9')]=function(){return channels;};exports[_0x287e('0xa')]=function(_0x156874){_0x156874=_0x156874[_0x287e('0xb')]();return _[_0x287e('0xc')](channels,_0x156874);};exports[_0x287e('0xd')]=function(_0x3d5d3b,_0x2ebd63,_0x130c4d,_0x343685){var _0x4d66ba={'loginAttempts':_0x2ebd63,'blocked':_0x130c4d};if(!_['isUndefined'](_0x343685)){_0x4d66ba[_0x287e('0xe')]=_0x343685;}return _0x3d5d3b[_0x287e('0xf')](_0x4d66ba);};exports['getLicense']=function(_0x546b1f){return new BPromise(function(_0x16a273,_0x349b3c){var _0x28656a=0x0;if(_0x546b1f[_0x287e('0x10')]!=='agent'){_0x16a273(_0x546b1f);}db[_0x287e('0x11')][_0x287e('0x12')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x546b1f['id']}}})[_0x287e('0x13')](function(_0x2d67d0){_0x28656a=_0x2d67d0;return util[_0x287e('0x14')]();})[_0x287e('0x13')](function(_0x365549){if(_0x365549&&_0x365549['agents']&&_0x28656a>=_0x365549[_0x287e('0x15')]){throw Error(_0x287e('0x16'));}_0x16a273(_0x546b1f);})[_0x287e('0x17')](function(_0x11ec58){_0x349b3c(_0x11ec58);});});};
\ No newline at end of file
+var _0x4128=['whatsapp','openchannel','isValidChannel','toLowerCase','includes','clearBlockUser','isUndefined','blockedAt','updateAttributes','getLicense','role','agent','User','then','agents','catch','bluebird','../mysqldb','chat','fax'];(function(_0x12f688,_0x585c25){var _0x59c3de=function(_0x4ac301){while(--_0x4ac301){_0x12f688['push'](_0x12f688['shift']());}};_0x59c3de(++_0x585c25);}(_0x4128,0x1f0));var _0x8412=function(_0x15b071,_0x7e182e){_0x15b071=_0x15b071-0x0;var _0xa3a80f=_0x4128[_0x15b071];return _0xa3a80f;};'use strict';var _=require('lodash');var BPromise=require(_0x8412('0x0'));var db=require(_0x8412('0x1'))['db'];var util=require('./license/util');var channels=['voice','mail',_0x8412('0x2'),_0x8412('0x3'),'sms',_0x8412('0x4'),_0x8412('0x5')];exports['getChannels']=function(){return channels;};exports[_0x8412('0x6')]=function(_0x58cbcd){_0x58cbcd=_0x58cbcd[_0x8412('0x7')]();return _[_0x8412('0x8')](channels,_0x58cbcd);};exports[_0x8412('0x9')]=function(_0x29d249,_0x4ad215,_0x157827,_0x37003d){var _0x35a0d5={'loginAttempts':_0x4ad215,'blocked':_0x157827};if(!_[_0x8412('0xa')](_0x37003d)){_0x35a0d5[_0x8412('0xb')]=_0x37003d;}return _0x29d249[_0x8412('0xc')](_0x35a0d5);};exports[_0x8412('0xd')]=function(_0x36c727){return new BPromise(function(_0x269e03,_0x314a25){var _0xd667cc=0x0;if(_0x36c727[_0x8412('0xe')]!==_0x8412('0xf')){_0x269e03(_0x36c727);}db[_0x8412('0x10')]['count']({'where':{'role':_0x8412('0xf'),'online':!![],'id':{'$ne':_0x36c727['id']}}})[_0x8412('0x11')](function(_0x4524e5){_0xd667cc=_0x4524e5;return util[_0x8412('0xd')]();})[_0x8412('0x11')](function(_0x2fd228){if(_0x2fd228&&_0x2fd228['agents']&&_0xd667cc>=_0x2fd228[_0x8412('0x12')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x269e03(_0x36c727);})[_0x8412('0x13')](function(_0x4c39c2){_0x314a25(_0x4c39c2);});});};
\ No newline at end of file