Built motion from commit 3c2ce842.|2.6.31
[motion2.git] / server / config / utils.js
index f138fdd..6f1e6d1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5e0c=['then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','bluebird','mail','chat','fax','sms','whatsapp','openchannel','isValidChannel','includes','blockedAt','getLicense','role','agent','User','count'];(function(_0xfdca,_0x179a1c){var _0x4ebbf0=function(_0x325d05){while(--_0x325d05){_0xfdca['push'](_0xfdca['shift']());}};_0x4ebbf0(++_0x179a1c);}(_0x5e0c,0x1d0));var _0xc5e0=function(_0x91d498,_0x482a89){_0x91d498=_0x91d498-0x0;var _0x1e0294=_0x5e0c[_0x91d498];return _0x1e0294;};'use strict';var _=require(_0xc5e0('0x0'));var BPromise=require(_0xc5e0('0x1'));var db=require('../mysqldb')['db'];var util=require('./license/util');var channels=['voice',_0xc5e0('0x2'),_0xc5e0('0x3'),_0xc5e0('0x4'),_0xc5e0('0x5'),_0xc5e0('0x6'),_0xc5e0('0x7')];exports['getChannels']=function(){return channels;};exports[_0xc5e0('0x8')]=function(_0x1c06c5){_0x1c06c5=_0x1c06c5['toLowerCase']();return _[_0xc5e0('0x9')](channels,_0x1c06c5);};exports['clearBlockUser']=function(_0x5afafe,_0x50dd0e,_0x19618c,_0x213dc9){var _0x3f8873={'loginAttempts':_0x50dd0e,'blocked':_0x19618c};if(!_['isUndefined'](_0x213dc9)){_0x3f8873[_0xc5e0('0xa')]=_0x213dc9;}return _0x5afafe['updateAttributes'](_0x3f8873);};exports[_0xc5e0('0xb')]=function(_0x3421bf){return new BPromise(function(_0x3e9b0d,_0x39e95c){var _0xcf02cf=0x0;if(_0x3421bf[_0xc5e0('0xc')]!==_0xc5e0('0xd')){_0x3e9b0d(_0x3421bf);}db[_0xc5e0('0xe')][_0xc5e0('0xf')]({'where':{'role':_0xc5e0('0xd'),'online':!![],'id':{'$ne':_0x3421bf['id']}}})[_0xc5e0('0x10')](function(_0x6e2179){_0xcf02cf=_0x6e2179;return util['getLicense']();})[_0xc5e0('0x10')](function(_0x26fabe){if(_0x26fabe&&_0x26fabe[_0xc5e0('0x11')]&&_0xcf02cf>=_0x26fabe[_0xc5e0('0x11')]){throw Error(_0xc5e0('0x12'));}_0x3e9b0d(_0x3421bf);})[_0xc5e0('0x13')](function(_0x2c049e){_0x39e95c(_0x2c049e);});});};
\ No newline at end of file
+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