Built motion from commit d5e4af8c.|2.6.23
[motion2.git] / server / config / utils.js
index e302777..0ca4529 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2a03=['getChannels','toLowerCase','clearBlockUser','isUndefined','blockedAt','getLicense','role','agent','count','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','bluebird','./license/util','mail','chat','fax','sms','whatsapp','openchannel'];(function(_0x21cf1b,_0x77039d){var _0x2b4502=function(_0x254548){while(--_0x254548){_0x21cf1b['push'](_0x21cf1b['shift']());}};_0x2b4502(++_0x77039d);}(_0x2a03,0x133));var _0x32a0=function(_0x546f45,_0x3a0b48){_0x546f45=_0x546f45-0x0;var _0x3058cc=_0x2a03[_0x546f45];return _0x3058cc;};'use strict';var _=require('lodash');var BPromise=require(_0x32a0('0x0'));var db=require('../mysqldb')['db'];var util=require(_0x32a0('0x1'));var channels=['voice',_0x32a0('0x2'),_0x32a0('0x3'),_0x32a0('0x4'),_0x32a0('0x5'),_0x32a0('0x6'),_0x32a0('0x7')];exports[_0x32a0('0x8')]=function(){return channels;};exports['isValidChannel']=function(_0x35cb3e){_0x35cb3e=_0x35cb3e[_0x32a0('0x9')]();return _['includes'](channels,_0x35cb3e);};exports[_0x32a0('0xa')]=function(_0x374c6b,_0x2cc224,_0x4b320f,_0x129f28){var _0x371cfb={'loginAttempts':_0x2cc224,'blocked':_0x4b320f};if(!_[_0x32a0('0xb')](_0x129f28)){_0x371cfb[_0x32a0('0xc')]=_0x129f28;}return _0x374c6b['updateAttributes'](_0x371cfb);};exports[_0x32a0('0xd')]=function(_0x1aeb70){return new BPromise(function(_0x1f7038,_0x5e3092){var _0x594ffe=0x0;if(_0x1aeb70[_0x32a0('0xe')]!==_0x32a0('0xf')){_0x1f7038(_0x1aeb70);}db['User'][_0x32a0('0x10')]({'where':{'role':_0x32a0('0xf'),'online':!![],'id':{'$ne':_0x1aeb70['id']}}})[_0x32a0('0x11')](function(_0x2801d0){_0x594ffe=_0x2801d0;return util['getLicense']();})[_0x32a0('0x11')](function(_0x498bac){if(_0x498bac&&_0x498bac['agents']&&_0x594ffe>=_0x498bac[_0x32a0('0x12')]){throw Error(_0x32a0('0x13'));}_0x1f7038(_0x1aeb70);})[_0x32a0('0x14')](function(_0x5d4276){_0x5e3092(_0x5d4276);});});};
\ No newline at end of file
+var _0x12e2=['chat','fax','sms','whatsapp','openchannel','getChannels','isValidChannel','includes','clearBlockUser','isUndefined','blockedAt','updateAttributes','getLicense','role','agent','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','../mysqldb','./license/util','voice'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x12e2,0xcb));var _0x212e=function(_0x5096f2,_0x428e9e){_0x5096f2=_0x5096f2-0x0;var _0x1200b4=_0x12e2[_0x5096f2];return _0x1200b4;};'use strict';var _=require(_0x212e('0x0'));var BPromise=require('bluebird');var db=require(_0x212e('0x1'))['db'];var util=require(_0x212e('0x2'));var channels=[_0x212e('0x3'),'mail',_0x212e('0x4'),_0x212e('0x5'),_0x212e('0x6'),_0x212e('0x7'),_0x212e('0x8')];exports[_0x212e('0x9')]=function(){return channels;};exports[_0x212e('0xa')]=function(_0x4a8fcc){_0x4a8fcc=_0x4a8fcc['toLowerCase']();return _[_0x212e('0xb')](channels,_0x4a8fcc);};exports[_0x212e('0xc')]=function(_0x3f184d,_0x994f9d,_0x1301f6,_0x69a5d){var _0xd1e322={'loginAttempts':_0x994f9d,'blocked':_0x1301f6};if(!_[_0x212e('0xd')](_0x69a5d)){_0xd1e322[_0x212e('0xe')]=_0x69a5d;}return _0x3f184d[_0x212e('0xf')](_0xd1e322);};exports[_0x212e('0x10')]=function(_0x1fb6f7){return new BPromise(function(_0x2e614e,_0x95fffc){var _0x4095cb=0x0;if(_0x1fb6f7[_0x212e('0x11')]!==_0x212e('0x12')){_0x2e614e(_0x1fb6f7);}db['User']['count']({'where':{'role':_0x212e('0x12'),'online':!![],'id':{'$ne':_0x1fb6f7['id']}}})['then'](function(_0x4e5741){_0x4095cb=_0x4e5741;return util[_0x212e('0x10')]();})[_0x212e('0x13')](function(_0x111f50){if(_0x111f50&&_0x111f50[_0x212e('0x14')]&&_0x4095cb>=_0x111f50[_0x212e('0x14')]){throw Error(_0x212e('0x15'));}_0x2e614e(_0x1fb6f7);})[_0x212e('0x16')](function(_0x4392cb){_0x95fffc(_0x4392cb);});});};
\ No newline at end of file