Built motion from commit 52c8a02d.|2.6.29
[motion2.git] / server / config / utils.js
index 5dd62a5..a3448f2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x99cd=['whatsapp','openchannel','isValidChannel','toLowerCase','blockedAt','updateAttributes','getLicense','role','count','agent','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','bluebird','../mysqldb','voice','mail','fax'];(function(_0xbf171b,_0x21c916){var _0x21ab7e=function(_0x46a03d){while(--_0x46a03d){_0xbf171b['push'](_0xbf171b['shift']());}};_0x21ab7e(++_0x21c916);}(_0x99cd,0x9a));var _0xd99c=function(_0x166b35,_0x3ad006){_0x166b35=_0x166b35-0x0;var _0x5b1cae=_0x99cd[_0x166b35];return _0x5b1cae;};'use strict';var _=require(_0xd99c('0x0'));var BPromise=require(_0xd99c('0x1'));var db=require(_0xd99c('0x2'))['db'];var util=require('./license/util');var channels=[_0xd99c('0x3'),_0xd99c('0x4'),'chat',_0xd99c('0x5'),'sms',_0xd99c('0x6'),_0xd99c('0x7')];exports['getChannels']=function(){return channels;};exports[_0xd99c('0x8')]=function(_0x413416){_0x413416=_0x413416[_0xd99c('0x9')]();return _['includes'](channels,_0x413416);};exports['clearBlockUser']=function(_0xd4bb24,_0x281bfd,_0x58a8a1,_0x629bc6){var _0x9120d={'loginAttempts':_0x281bfd,'blocked':_0x58a8a1};if(!_['isUndefined'](_0x629bc6)){_0x9120d[_0xd99c('0xa')]=_0x629bc6;}return _0xd4bb24[_0xd99c('0xb')](_0x9120d);};exports[_0xd99c('0xc')]=function(_0x3f9af3){return new BPromise(function(_0x1d31c9,_0x5bc5b5){var _0x1199c8=0x0;if(_0x3f9af3[_0xd99c('0xd')]!=='agent'){_0x1d31c9(_0x3f9af3);}db['User'][_0xd99c('0xe')]({'where':{'role':_0xd99c('0xf'),'online':!![],'id':{'$ne':_0x3f9af3['id']}}})[_0xd99c('0x10')](function(_0x397cc0){_0x1199c8=_0x397cc0;return util['getLicense']();})[_0xd99c('0x10')](function(_0x574395){if(_0x574395&&_0x574395[_0xd99c('0x11')]&&_0x1199c8>=_0x574395['agents']){throw Error(_0xd99c('0x12'));}_0x1d31c9(_0x3f9af3);})[_0xd99c('0x13')](function(_0x145f94){_0x5bc5b5(_0x145f94);});});};
\ 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