Built motion from commit (unavailable).|2.4.4
[motion2.git] / server / config / utils.js
index 7ec8925..a27d62b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-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
+var _0xf1c1=['includes','clearBlockUser','isUndefined','blockedAt','updateAttributes','role','agent','count','then','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','catch','./license/util','mail','fax','sms','isValidChannel','toLowerCase'];(function(_0xb2f18b,_0xe1bf15){var _0x3a7582=function(_0x253170){while(--_0x253170){_0xb2f18b['push'](_0xb2f18b['shift']());}};_0x3a7582(++_0xe1bf15);}(_0xf1c1,0xde));var _0x1f1c=function(_0x5986fa,_0x14f120){_0x5986fa=_0x5986fa-0x0;var _0x44a886=_0xf1c1[_0x5986fa];return _0x44a886;};'use strict';var _=require('lodash');var BPromise=require('bluebird');var db=require('../mysqldb')['db'];var util=require(_0x1f1c('0x0'));var channels=['voice',_0x1f1c('0x1'),'chat',_0x1f1c('0x2'),_0x1f1c('0x3'),'openchannel'];exports['getChannels']=function(){return channels;};exports[_0x1f1c('0x4')]=function(_0x4af078){_0x4af078=_0x4af078[_0x1f1c('0x5')]();return _[_0x1f1c('0x6')](channels,_0x4af078);};exports[_0x1f1c('0x7')]=function(_0x21cb9b,_0x1e68f8,_0x100301,_0x297e43){var _0x57e0cd={'loginAttempts':_0x1e68f8,'blocked':_0x100301};if(!_[_0x1f1c('0x8')](_0x297e43)){_0x57e0cd[_0x1f1c('0x9')]=_0x297e43;}return _0x21cb9b[_0x1f1c('0xa')](_0x57e0cd);};exports['getLicense']=function(_0x1f0483){return new BPromise(function(_0x391e98,_0x102331){var _0x141d15=0x0;if(_0x1f0483[_0x1f1c('0xb')]!==_0x1f1c('0xc')){_0x391e98(_0x1f0483);}db['User'][_0x1f1c('0xd')]({'where':{'role':_0x1f1c('0xc'),'online':!![],'id':{'$ne':_0x1f0483['id']}}})[_0x1f1c('0xe')](function(_0x2a038a){_0x141d15=_0x2a038a;return util[_0x1f1c('0xf')]();})['then'](function(_0x4cee57){if(_0x4cee57&&_0x4cee57['agents']&&_0x141d15>=_0x4cee57[_0x1f1c('0x10')]){throw Error(_0x1f1c('0x11'));}_0x391e98(_0x1f0483);})[_0x1f1c('0x12')](function(_0x50c284){_0x102331(_0x50c284);});});};
\ No newline at end of file