Built motion from commit 52c8a02d.|2.6.29
[motion2.git] / server / config / utils.js
index 7cef626..a3448f2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe914=['bluebird','./license/util','voice','mail','fax','sms','whatsapp','openchannel','getChannels','isValidChannel','clearBlockUser','isUndefined','blockedAt','updateAttributes','getLicense','User','count','agent','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash'];(function(_0x5c1aa2,_0x4274b1){var _0x4c4d28=function(_0x2714af){while(--_0x2714af){_0x5c1aa2['push'](_0x5c1aa2['shift']());}};_0x4c4d28(++_0x4274b1);}(_0xe914,0xaf));var _0x4e91=function(_0x593603,_0x235322){_0x593603=_0x593603-0x0;var _0x59ac0b=_0xe914[_0x593603];return _0x59ac0b;};'use strict';var _=require(_0x4e91('0x0'));var BPromise=require(_0x4e91('0x1'));var db=require('../mysqldb')['db'];var util=require(_0x4e91('0x2'));var channels=[_0x4e91('0x3'),_0x4e91('0x4'),'chat',_0x4e91('0x5'),_0x4e91('0x6'),_0x4e91('0x7'),_0x4e91('0x8')];exports[_0x4e91('0x9')]=function(){return channels;};exports[_0x4e91('0xa')]=function(_0x201106){_0x201106=_0x201106['toLowerCase']();return _['includes'](channels,_0x201106);};exports[_0x4e91('0xb')]=function(_0x4f66b1,_0x456194,_0x409699,_0x169d40){var _0x68053e={'loginAttempts':_0x456194,'blocked':_0x409699};if(!_[_0x4e91('0xc')](_0x169d40)){_0x68053e[_0x4e91('0xd')]=_0x169d40;}return _0x4f66b1[_0x4e91('0xe')](_0x68053e);};exports[_0x4e91('0xf')]=function(_0x35ef5f){return new BPromise(function(_0x4ffa6d,_0x263f7f){var _0x3dedf4=0x0;if(_0x35ef5f['role']!=='agent'){_0x4ffa6d(_0x35ef5f);}db[_0x4e91('0x10')][_0x4e91('0x11')]({'where':{'role':_0x4e91('0x12'),'online':!![],'id':{'$ne':_0x35ef5f['id']}}})['then'](function(_0x28421a){_0x3dedf4=_0x28421a;return util[_0x4e91('0xf')]();})['then'](function(_0x43d9ed){if(_0x43d9ed&&_0x43d9ed[_0x4e91('0x13')]&&_0x3dedf4>=_0x43d9ed[_0x4e91('0x13')]){throw Error(_0x4e91('0x14'));}_0x4ffa6d(_0x35ef5f);})[_0x4e91('0x15')](function(_0x333e51){_0x263f7f(_0x333e51);});});};
\ No newline at end of file
+var _0xe0e8=['bluebird','../mysqldb','./license/util','voice','mail','chat','sms','whatsapp','openchannel','getChannels','isValidChannel','toLowerCase','includes','clearBlockUser','isUndefined','blockedAt','role','agent','User','count','then','agents','catch','lodash'];(function(_0xc8f7fa,_0x240856){var _0x1ed515=function(_0x44e9dc){while(--_0x44e9dc){_0xc8f7fa['push'](_0xc8f7fa['shift']());}};_0x1ed515(++_0x240856);}(_0xe0e8,0x1c7));var _0x8e0e=function(_0xc80551,_0x579477){_0xc80551=_0xc80551-0x0;var _0x25e526=_0xe0e8[_0xc80551];return _0x25e526;};'use strict';var _=require(_0x8e0e('0x0'));var BPromise=require(_0x8e0e('0x1'));var db=require(_0x8e0e('0x2'))['db'];var util=require(_0x8e0e('0x3'));var channels=[_0x8e0e('0x4'),_0x8e0e('0x5'),_0x8e0e('0x6'),'fax',_0x8e0e('0x7'),_0x8e0e('0x8'),_0x8e0e('0x9')];exports[_0x8e0e('0xa')]=function(){return channels;};exports[_0x8e0e('0xb')]=function(_0x3cf465){_0x3cf465=_0x3cf465[_0x8e0e('0xc')]();return _[_0x8e0e('0xd')](channels,_0x3cf465);};exports[_0x8e0e('0xe')]=function(_0x4d84a6,_0x25f852,_0x5cdd89,_0x12642a){var _0x3dc74d={'loginAttempts':_0x25f852,'blocked':_0x5cdd89};if(!_[_0x8e0e('0xf')](_0x12642a)){_0x3dc74d[_0x8e0e('0x10')]=_0x12642a;}return _0x4d84a6['updateAttributes'](_0x3dc74d);};exports['getLicense']=function(_0x238ddd){return new BPromise(function(_0x568434,_0x4de41a){var _0x824111=0x0;if(_0x238ddd[_0x8e0e('0x11')]!==_0x8e0e('0x12')){_0x568434(_0x238ddd);}db[_0x8e0e('0x13')][_0x8e0e('0x14')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x238ddd['id']}}})[_0x8e0e('0x15')](function(_0x3ecb52){_0x824111=_0x3ecb52;return util['getLicense']();})['then'](function(_0x50e0fe){if(_0x50e0fe&&_0x50e0fe[_0x8e0e('0x16')]&&_0x824111>=_0x50e0fe['agents']){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x568434(_0x238ddd);})[_0x8e0e('0x17')](function(_0x173ef5){_0x4de41a(_0x173ef5);});});};
\ No newline at end of file