Built motion from commit efa66e19.|2.6.22
[motion2.git] / server / config / utils.js
index 438f8fc..e302777 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5f8e=['includes','clearBlockUser','blockedAt','getLicense','User','agent','then','agents','catch','lodash','bluebird','../mysqldb','voice','fax','sms','whatsapp','openchannel','getChannels','isValidChannel','toLowerCase'];(function(_0x4929fd,_0x2c9d98){var _0x1a700d=function(_0xf85861){while(--_0xf85861){_0x4929fd['push'](_0x4929fd['shift']());}};_0x1a700d(++_0x2c9d98);}(_0x5f8e,0xd1));var _0xe5f8=function(_0x45aa72,_0x8af642){_0x45aa72=_0x45aa72-0x0;var _0x75adaa=_0x5f8e[_0x45aa72];return _0x75adaa;};'use strict';var _=require(_0xe5f8('0x0'));var BPromise=require(_0xe5f8('0x1'));var db=require(_0xe5f8('0x2'))['db'];var util=require('./license/util');var channels=[_0xe5f8('0x3'),'mail','chat',_0xe5f8('0x4'),_0xe5f8('0x5'),_0xe5f8('0x6'),_0xe5f8('0x7')];exports[_0xe5f8('0x8')]=function(){return channels;};exports[_0xe5f8('0x9')]=function(_0xeddaf5){_0xeddaf5=_0xeddaf5[_0xe5f8('0xa')]();return _[_0xe5f8('0xb')](channels,_0xeddaf5);};exports[_0xe5f8('0xc')]=function(_0xa4ff91,_0x55e2f0,_0x309fb9,_0x4a4464){var _0x241420={'loginAttempts':_0x55e2f0,'blocked':_0x309fb9};if(!_['isUndefined'](_0x4a4464)){_0x241420[_0xe5f8('0xd')]=_0x4a4464;}return _0xa4ff91['updateAttributes'](_0x241420);};exports[_0xe5f8('0xe')]=function(_0x4ec143){return new BPromise(function(_0x47d949,_0x415e0a){var _0x6c0183=0x0;if(_0x4ec143['role']!=='agent'){_0x47d949(_0x4ec143);}db[_0xe5f8('0xf')]['count']({'where':{'role':_0xe5f8('0x10'),'online':!![],'id':{'$ne':_0x4ec143['id']}}})[_0xe5f8('0x11')](function(_0x3f8792){_0x6c0183=_0x3f8792;return util[_0xe5f8('0xe')]();})[_0xe5f8('0x11')](function(_0x4ce507){if(_0x4ce507&&_0x4ce507[_0xe5f8('0x12')]&&_0x6c0183>=_0x4ce507[_0xe5f8('0x12')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x47d949(_0x4ec143);})[_0xe5f8('0x13')](function(_0x389fcc){_0x415e0a(_0x389fcc);});});};
\ No newline at end of file
+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