Built motion from commit da24aabd.|2.6.20
[motion2.git] / server / config / utils.js
index ee401f9..e64fe5b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xdd15=['role','agent','User','count','then','getLicense','agents','catch','lodash','bluebird','./license/util','voice','fax','sms','whatsapp','openchannel','getChannels','isValidChannel','includes','clearBlockUser','isUndefined','blockedAt'];(function(_0x5d3216,_0x3ec160){var _0x3b6dec=function(_0x2371c3){while(--_0x2371c3){_0x5d3216['push'](_0x5d3216['shift']());}};_0x3b6dec(++_0x3ec160);}(_0xdd15,0x17e));var _0x5dd1=function(_0x533e4e,_0x4eba54){_0x533e4e=_0x533e4e-0x0;var _0x1f14bb=_0xdd15[_0x533e4e];return _0x1f14bb;};'use strict';var _=require(_0x5dd1('0x0'));var BPromise=require(_0x5dd1('0x1'));var db=require('../mysqldb')['db'];var util=require(_0x5dd1('0x2'));var channels=[_0x5dd1('0x3'),'mail','chat',_0x5dd1('0x4'),_0x5dd1('0x5'),_0x5dd1('0x6'),_0x5dd1('0x7')];exports[_0x5dd1('0x8')]=function(){return channels;};exports[_0x5dd1('0x9')]=function(_0x43b266){_0x43b266=_0x43b266['toLowerCase']();return _[_0x5dd1('0xa')](channels,_0x43b266);};exports[_0x5dd1('0xb')]=function(_0x426482,_0x47d9e0,_0x22457f,_0x92a7c9){var _0x5897cd={'loginAttempts':_0x47d9e0,'blocked':_0x22457f};if(!_[_0x5dd1('0xc')](_0x92a7c9)){_0x5897cd[_0x5dd1('0xd')]=_0x92a7c9;}return _0x426482['updateAttributes'](_0x5897cd);};exports['getLicense']=function(_0x583aff){return new BPromise(function(_0x49ab52,_0x3f454c){var _0x3c02eb=0x0;if(_0x583aff[_0x5dd1('0xe')]!==_0x5dd1('0xf')){_0x49ab52(_0x583aff);}db[_0x5dd1('0x10')][_0x5dd1('0x11')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x583aff['id']}}})[_0x5dd1('0x12')](function(_0x2e44ce){_0x3c02eb=_0x2e44ce;return util[_0x5dd1('0x13')]();})[_0x5dd1('0x12')](function(_0x15c945){if(_0x15c945&&_0x15c945[_0x5dd1('0x14')]&&_0x3c02eb>=_0x15c945['agents']){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x49ab52(_0x583aff);})[_0x5dd1('0x15')](function(_0x18695c){_0x3f454c(_0x18695c);});});};
\ No newline at end of file
+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