Built motion from commit b5996064.|2.6.21
[motion2.git] / server / config / utils.js
index e64fe5b..438f8fc 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf552=['agent','User','then','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','lodash','bluebird','./license/util','voice','mail','chat','sms','whatsapp','openchannel','isValidChannel','toLowerCase','includes','clearBlockUser','blockedAt'];(function(_0x364b28,_0x12628a){var _0x56263e=function(_0x4ec03b){while(--_0x4ec03b){_0x364b28['push'](_0x364b28['shift']());}};_0x56263e(++_0x12628a);}(_0xf552,0x15a));var _0x2f55=function(_0x3e7bb8,_0x11f26c){_0x3e7bb8=_0x3e7bb8-0x0;var _0x160bf4=_0xf552[_0x3e7bb8];return _0x160bf4;};'use strict';var _=require(_0x2f55('0x0'));var BPromise=require(_0x2f55('0x1'));var db=require('../mysqldb')['db'];var util=require(_0x2f55('0x2'));var channels=[_0x2f55('0x3'),_0x2f55('0x4'),_0x2f55('0x5'),'fax',_0x2f55('0x6'),_0x2f55('0x7'),_0x2f55('0x8')];exports['getChannels']=function(){return channels;};exports[_0x2f55('0x9')]=function(_0x2e6864){_0x2e6864=_0x2e6864[_0x2f55('0xa')]();return _[_0x2f55('0xb')](channels,_0x2e6864);};exports[_0x2f55('0xc')]=function(_0x336e4a,_0x48bc8e,_0x5bb72,_0x2279d8){var _0x3d3d90={'loginAttempts':_0x48bc8e,'blocked':_0x5bb72};if(!_['isUndefined'](_0x2279d8)){_0x3d3d90[_0x2f55('0xd')]=_0x2279d8;}return _0x336e4a['updateAttributes'](_0x3d3d90);};exports['getLicense']=function(_0x2f255e){return new BPromise(function(_0x48b681,_0x102d54){var _0x6898c=0x0;if(_0x2f255e['role']!==_0x2f55('0xe')){_0x48b681(_0x2f255e);}db[_0x2f55('0xf')]['count']({'where':{'role':_0x2f55('0xe'),'online':!![],'id':{'$ne':_0x2f255e['id']}}})[_0x2f55('0x10')](function(_0x476a60){_0x6898c=_0x476a60;return util[_0x2f55('0x11')]();})[_0x2f55('0x10')](function(_0x846425){if(_0x846425&&_0x846425[_0x2f55('0x12')]&&_0x6898c>=_0x846425[_0x2f55('0x12')]){throw Error(_0x2f55('0x13'));}_0x48b681(_0x2f255e);})['catch'](function(_0x18205d){_0x102d54(_0x18205d);});});};
\ No newline at end of file
+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