Built motion from commit (unavailable).|2.4.4
[motion2.git] / server / config / utils.js
index 71e2277..7ec8925 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x70c7=['bluebird','../mysqldb','voice','mail','chat','fax','openchannel','getChannels','isValidChannel','toLowerCase','includes','clearBlockUser','blockedAt','getLicense','role','agent','User','count','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash'];(function(_0xf7ac63,_0xf52456){var _0x25b50d=function(_0x2aaa0a){while(--_0x2aaa0a){_0xf7ac63['push'](_0xf7ac63['shift']());}};_0x25b50d(++_0xf52456);}(_0x70c7,0xfc));var _0x770c=function(_0x41d8e7,_0x468e84){_0x41d8e7=_0x41d8e7-0x0;var _0x1b8edc=_0x70c7[_0x41d8e7];return _0x1b8edc;};'use strict';var _=require(_0x770c('0x0'));var BPromise=require(_0x770c('0x1'));var db=require(_0x770c('0x2'))['db'];var util=require('./license/util');var channels=[_0x770c('0x3'),_0x770c('0x4'),_0x770c('0x5'),_0x770c('0x6'),'sms',_0x770c('0x7')];exports[_0x770c('0x8')]=function(){return channels;};exports[_0x770c('0x9')]=function(_0xe4340c){_0xe4340c=_0xe4340c[_0x770c('0xa')]();return _[_0x770c('0xb')](channels,_0xe4340c);};exports[_0x770c('0xc')]=function(_0x536f43,_0xcf2c5c,_0x4f7934,_0x3d6b0e){var _0x566332={'loginAttempts':_0xcf2c5c,'blocked':_0x4f7934};if(!_['isUndefined'](_0x3d6b0e)){_0x566332[_0x770c('0xd')]=_0x3d6b0e;}return _0x536f43['updateAttributes'](_0x566332);};exports[_0x770c('0xe')]=function(_0xcedc81){return new BPromise(function(_0x32df0b,_0x216d6d){var _0x1b0e4e=0x0;if(_0xcedc81[_0x770c('0xf')]!==_0x770c('0x10')){_0x32df0b(_0xcedc81);}db[_0x770c('0x11')][_0x770c('0x12')]({'where':{'role':_0x770c('0x10'),'online':!![],'id':{'$ne':_0xcedc81['id']}}})[_0x770c('0x13')](function(_0x573d59){_0x1b0e4e=_0x573d59;return util[_0x770c('0xe')]();})[_0x770c('0x13')](function(_0x3eefa0){if(_0x3eefa0&&_0x3eefa0[_0x770c('0x14')]&&_0x1b0e4e>=_0x3eefa0['agents']){throw Error(_0x770c('0x15'));}_0x32df0b(_0xcedc81);})[_0x770c('0x16')](function(_0xfd43f1){_0x216d6d(_0xfd43f1);});});};
\ No newline at end of file
+var _0x1f2f=['./license/util','voice','mail','chat','fax','sms','openchannel','getChannels','isValidChannel','toLowerCase','includes','clearBlockUser','isUndefined','blockedAt','getLicense','agent','count','agents','catch','lodash','../mysqldb'];(function(_0x552128,_0x21c201){var _0x2392ce=function(_0x3a09f8){while(--_0x3a09f8){_0x552128['push'](_0x552128['shift']());}};_0x2392ce(++_0x21c201);}(_0x1f2f,0xa6));var _0xf1f2=function(_0x4c99ee,_0x2d8768){_0x4c99ee=_0x4c99ee-0x0;var _0x24bc5f=_0x1f2f[_0x4c99ee];return _0x24bc5f;};'use strict';var _=require(_0xf1f2('0x0'));var BPromise=require('bluebird');var db=require(_0xf1f2('0x1'))['db'];var util=require(_0xf1f2('0x2'));var channels=[_0xf1f2('0x3'),_0xf1f2('0x4'),_0xf1f2('0x5'),_0xf1f2('0x6'),_0xf1f2('0x7'),_0xf1f2('0x8')];exports[_0xf1f2('0x9')]=function(){return channels;};exports[_0xf1f2('0xa')]=function(_0x39414c){_0x39414c=_0x39414c[_0xf1f2('0xb')]();return _[_0xf1f2('0xc')](channels,_0x39414c);};exports[_0xf1f2('0xd')]=function(_0x17b433,_0x3b5357,_0x28440e,_0x58b878){var _0x21ce9b={'loginAttempts':_0x3b5357,'blocked':_0x28440e};if(!_[_0xf1f2('0xe')](_0x58b878)){_0x21ce9b[_0xf1f2('0xf')]=_0x58b878;}return _0x17b433['updateAttributes'](_0x21ce9b);};exports[_0xf1f2('0x10')]=function(_0xde483e){return new BPromise(function(_0x364074,_0xc32835){var _0x580217=0x0;if(_0xde483e['role']!==_0xf1f2('0x11')){_0x364074(_0xde483e);}db['User'][_0xf1f2('0x12')]({'where':{'role':_0xf1f2('0x11'),'online':!![],'id':{'$ne':_0xde483e['id']}}})['then'](function(_0x14a12c){_0x580217=_0x14a12c;return util[_0xf1f2('0x10')]();})['then'](function(_0x450eff){if(_0x450eff&&_0x450eff[_0xf1f2('0x13')]&&_0x580217>=_0x450eff['agents']){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x364074(_0xde483e);})[_0xf1f2('0x14')](function(_0x21747a){_0xc32835(_0x21747a);});});};
\ No newline at end of file