Built motion from commit 953226e6.|2.6.32
[motion2.git] / server / config / utils.js
index 6f1e6d1..5b2fac5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3e21=['count','then','agents','catch','bluebird','../mysqldb','./license/util','voice','chat','sms','whatsapp','openchannel','getChannels','isValidChannel','toLowerCase','blockedAt','updateAttributes','getLicense','role','agent','User'];(function(_0x24465c,_0x426147){var _0x2bcf6f=function(_0x56bdb8){while(--_0x56bdb8){_0x24465c['push'](_0x24465c['shift']());}};_0x2bcf6f(++_0x426147);}(_0x3e21,0x1d2));var _0x13e2=function(_0x173377,_0x3a940e){_0x173377=_0x173377-0x0;var _0xf46120=_0x3e21[_0x173377];return _0xf46120;};'use strict';var _=require('lodash');var BPromise=require(_0x13e2('0x0'));var db=require(_0x13e2('0x1'))['db'];var util=require(_0x13e2('0x2'));var channels=[_0x13e2('0x3'),'mail',_0x13e2('0x4'),'fax',_0x13e2('0x5'),_0x13e2('0x6'),_0x13e2('0x7')];exports[_0x13e2('0x8')]=function(){return channels;};exports[_0x13e2('0x9')]=function(_0x19ef20){_0x19ef20=_0x19ef20[_0x13e2('0xa')]();return _['includes'](channels,_0x19ef20);};exports['clearBlockUser']=function(_0x3517e9,_0x110ea9,_0x5b2d84,_0x25b59f){var _0x301563={'loginAttempts':_0x110ea9,'blocked':_0x5b2d84};if(!_['isUndefined'](_0x25b59f)){_0x301563[_0x13e2('0xb')]=_0x25b59f;}return _0x3517e9[_0x13e2('0xc')](_0x301563);};exports[_0x13e2('0xd')]=function(_0x5bfd11){return new BPromise(function(_0x53f470,_0x4cb452){var _0x4e581c=0x0;if(_0x5bfd11[_0x13e2('0xe')]!==_0x13e2('0xf')){_0x53f470(_0x5bfd11);}db[_0x13e2('0x10')][_0x13e2('0x11')]({'where':{'role':_0x13e2('0xf'),'online':!![],'id':{'$ne':_0x5bfd11['id']}}})[_0x13e2('0x12')](function(_0x50179e){_0x4e581c=_0x50179e;return util['getLicense']();})[_0x13e2('0x12')](function(_0x5003f0){if(_0x5003f0&&_0x5003f0[_0x13e2('0x13')]&&_0x4e581c>=_0x5003f0['agents']){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x53f470(_0x5bfd11);})[_0x13e2('0x14')](function(_0x3959f7){_0x4cb452(_0x3959f7);});});};
\ No newline at end of file
+var _0x8ee5=['getLicense','role','agent','User','count','then','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','bluebird','../mysqldb','./license/util','mail','whatsapp','openchannel','getChannels','toLowerCase','includes','clearBlockUser','blockedAt','updateAttributes'];(function(_0x50c537,_0x5401fb){var _0x546147=function(_0x184cae){while(--_0x184cae){_0x50c537['push'](_0x50c537['shift']());}};_0x546147(++_0x5401fb);}(_0x8ee5,0x182));var _0x58ee=function(_0x2e52e0,_0x2fcaf2){_0x2e52e0=_0x2e52e0-0x0;var _0xb4b909=_0x8ee5[_0x2e52e0];return _0xb4b909;};'use strict';var _=require(_0x58ee('0x0'));var BPromise=require(_0x58ee('0x1'));var db=require(_0x58ee('0x2'))['db'];var util=require(_0x58ee('0x3'));var channels=['voice',_0x58ee('0x4'),'chat','fax','sms',_0x58ee('0x5'),_0x58ee('0x6')];exports[_0x58ee('0x7')]=function(){return channels;};exports['isValidChannel']=function(_0x34c827){_0x34c827=_0x34c827[_0x58ee('0x8')]();return _[_0x58ee('0x9')](channels,_0x34c827);};exports[_0x58ee('0xa')]=function(_0x20004f,_0x56b27e,_0x55447f,_0x1ea974){var _0x4f6657={'loginAttempts':_0x56b27e,'blocked':_0x55447f};if(!_['isUndefined'](_0x1ea974)){_0x4f6657[_0x58ee('0xb')]=_0x1ea974;}return _0x20004f[_0x58ee('0xc')](_0x4f6657);};exports[_0x58ee('0xd')]=function(_0x2427ac){return new BPromise(function(_0x4e7fed,_0x2f311d){var _0x4ef43b=0x0;if(_0x2427ac[_0x58ee('0xe')]!==_0x58ee('0xf')){_0x4e7fed(_0x2427ac);}db[_0x58ee('0x10')][_0x58ee('0x11')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x2427ac['id']}}})['then'](function(_0x1cc553){_0x4ef43b=_0x1cc553;return util['getLicense']();})[_0x58ee('0x12')](function(_0x5bf39c){if(_0x5bf39c&&_0x5bf39c['agents']&&_0x4ef43b>=_0x5bf39c['agents']){throw Error(_0x58ee('0x13'));}_0x4e7fed(_0x2427ac);})[_0x58ee('0x14')](function(_0x13e0ab){_0x2f311d(_0x13e0ab);});});};
\ No newline at end of file