Built motion from commit cb845558.|2.6.34
[motion2.git] / server / config / utils.js
index 65d0e6d..3fdf075 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb78d=['openchannel','getChannels','isValidChannel','toLowerCase','includes','isUndefined','blockedAt','updateAttributes','getLicense','role','agent','count','then','catch','lodash','bluebird','./license/util','voice','mail','whatsapp'];(function(_0x545eb3,_0x2d590c){var _0x24beed=function(_0x4fe828){while(--_0x4fe828){_0x545eb3['push'](_0x545eb3['shift']());}};_0x24beed(++_0x2d590c);}(_0xb78d,0x9a));var _0xdb78=function(_0x17d7b6,_0x336557){_0x17d7b6=_0x17d7b6-0x0;var _0x16ee4b=_0xb78d[_0x17d7b6];return _0x16ee4b;};'use strict';var _=require(_0xdb78('0x0'));var BPromise=require(_0xdb78('0x1'));var db=require('../mysqldb')['db'];var util=require(_0xdb78('0x2'));var channels=[_0xdb78('0x3'),_0xdb78('0x4'),'chat','fax','sms',_0xdb78('0x5'),_0xdb78('0x6')];exports[_0xdb78('0x7')]=function(){return channels;};exports[_0xdb78('0x8')]=function(_0x14bf3a){_0x14bf3a=_0x14bf3a[_0xdb78('0x9')]();return _[_0xdb78('0xa')](channels,_0x14bf3a);};exports['clearBlockUser']=function(_0x487376,_0x96736c,_0x8eeab5,_0xea0859){var _0x115ec3={'loginAttempts':_0x96736c,'blocked':_0x8eeab5};if(!_[_0xdb78('0xb')](_0xea0859)){_0x115ec3[_0xdb78('0xc')]=_0xea0859;}return _0x487376[_0xdb78('0xd')](_0x115ec3);};exports[_0xdb78('0xe')]=function(_0x174e02){return new BPromise(function(_0x30e99a,_0x2814df){var _0x22e695=0x0;if(_0x174e02[_0xdb78('0xf')]!==_0xdb78('0x10')){_0x30e99a(_0x174e02);}db['User'][_0xdb78('0x11')]({'where':{'role':_0xdb78('0x10'),'online':!![],'id':{'$ne':_0x174e02['id']}}})[_0xdb78('0x12')](function(_0x419cf9){_0x22e695=_0x419cf9;return util[_0xdb78('0xe')]();})['then'](function(_0x56b687){if(_0x56b687&&_0x56b687['agents']&&_0x22e695>=_0x56b687['agents']){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x30e99a(_0x174e02);})[_0xdb78('0x13')](function(_0x467a61){_0x2814df(_0x467a61);});});};
\ No newline at end of file
+var _0x339f=['toLowerCase','includes','clearBlockUser','updateAttributes','role','User','count','agent','getLicense','then','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','bluebird','../mysqldb','./license/util','voice','mail','fax','whatsapp','openchannel','getChannels','isValidChannel'];(function(_0x3edbc9,_0x40b49d){var _0x3782f5=function(_0x2580ca){while(--_0x2580ca){_0x3edbc9['push'](_0x3edbc9['shift']());}};_0x3782f5(++_0x40b49d);}(_0x339f,0x7f));var _0xf339=function(_0xcda15e,_0x335064){_0xcda15e=_0xcda15e-0x0;var _0x79bc1=_0x339f[_0xcda15e];return _0x79bc1;};'use strict';var _=require(_0xf339('0x0'));var BPromise=require(_0xf339('0x1'));var db=require(_0xf339('0x2'))['db'];var util=require(_0xf339('0x3'));var channels=[_0xf339('0x4'),_0xf339('0x5'),'chat',_0xf339('0x6'),'sms',_0xf339('0x7'),_0xf339('0x8')];exports[_0xf339('0x9')]=function(){return channels;};exports[_0xf339('0xa')]=function(_0x122758){_0x122758=_0x122758[_0xf339('0xb')]();return _[_0xf339('0xc')](channels,_0x122758);};exports[_0xf339('0xd')]=function(_0x347ccf,_0x40c9dc,_0x41e916,_0xf21631){var _0x4def61={'loginAttempts':_0x40c9dc,'blocked':_0x41e916};if(!_['isUndefined'](_0xf21631)){_0x4def61['blockedAt']=_0xf21631;}return _0x347ccf[_0xf339('0xe')](_0x4def61);};exports['getLicense']=function(_0x50705e){return new BPromise(function(_0x116035,_0x5435c8){var _0x3c8cfa=0x0;if(_0x50705e[_0xf339('0xf')]!=='agent'){_0x116035(_0x50705e);}db[_0xf339('0x10')][_0xf339('0x11')]({'where':{'role':_0xf339('0x12'),'online':!![],'id':{'$ne':_0x50705e['id']}}})['then'](function(_0x1f2aea){_0x3c8cfa=_0x1f2aea;return util[_0xf339('0x13')]();})[_0xf339('0x14')](function(_0x2ac504){if(_0x2ac504&&_0x2ac504['agents']&&_0x3c8cfa>=_0x2ac504['agents']){throw Error(_0xf339('0x15'));}_0x116035(_0x50705e);})[_0xf339('0x16')](function(_0xd02201){_0x5435c8(_0xd02201);});});};
\ No newline at end of file