Built motion from commit (unavailable).|2.5.4
[motion2.git] / server / config / utils.js
index 9889c07..2a4b83c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd16e=['chat','sms','whatsapp','openchannel','getChannels','toLowerCase','includes','clearBlockUser','blockedAt','updateAttributes','getLicense','role','agent','User','count','then','agents','lodash','bluebird','../mysqldb','./license/util','voice','mail'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xd16e,0xf7));var _0xed16=function(_0x4e2b4a,_0xa9798b){_0x4e2b4a=_0x4e2b4a-0x0;var _0x2ca442=_0xd16e[_0x4e2b4a];return _0x2ca442;};'use strict';var _=require(_0xed16('0x0'));var BPromise=require(_0xed16('0x1'));var db=require(_0xed16('0x2'))['db'];var util=require(_0xed16('0x3'));var channels=[_0xed16('0x4'),_0xed16('0x5'),_0xed16('0x6'),'fax',_0xed16('0x7'),_0xed16('0x8'),_0xed16('0x9')];exports[_0xed16('0xa')]=function(){return channels;};exports['isValidChannel']=function(_0x5b8cca){_0x5b8cca=_0x5b8cca[_0xed16('0xb')]();return _[_0xed16('0xc')](channels,_0x5b8cca);};exports[_0xed16('0xd')]=function(_0x28a653,_0x4cb541,_0x38d326,_0x112de8){var _0x2c780e={'loginAttempts':_0x4cb541,'blocked':_0x38d326};if(!_['isUndefined'](_0x112de8)){_0x2c780e[_0xed16('0xe')]=_0x112de8;}return _0x28a653[_0xed16('0xf')](_0x2c780e);};exports[_0xed16('0x10')]=function(_0x2f1290){return new BPromise(function(_0x553a3e,_0x4ad4d6){var _0x3531c7=0x0;if(_0x2f1290[_0xed16('0x11')]!==_0xed16('0x12')){_0x553a3e(_0x2f1290);}db[_0xed16('0x13')][_0xed16('0x14')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x2f1290['id']}}})[_0xed16('0x15')](function(_0x9c81a0){_0x3531c7=_0x9c81a0;return util[_0xed16('0x10')]();})[_0xed16('0x15')](function(_0x55c0fc){if(_0x55c0fc&&_0x55c0fc[_0xed16('0x16')]&&_0x3531c7>=_0x55c0fc[_0xed16('0x16')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x553a3e(_0x2f1290);})['catch'](function(_0x2aad2c){_0x4ad4d6(_0x2aad2c);});});};
\ No newline at end of file
+var _0xe41d=['getLicense','User','count','agent','then','agents','catch','bluebird','./license/util','voice','mail','fax','sms','whatsapp','getChannels','includes','isUndefined','blockedAt','updateAttributes'];(function(_0x598b6a,_0x56ad37){var _0x3affb6=function(_0x345c69){while(--_0x345c69){_0x598b6a['push'](_0x598b6a['shift']());}};_0x3affb6(++_0x56ad37);}(_0xe41d,0x137));var _0xde41=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe41d[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var BPromise=require(_0xde41('0x0'));var db=require('../mysqldb')['db'];var util=require(_0xde41('0x1'));var channels=[_0xde41('0x2'),_0xde41('0x3'),'chat',_0xde41('0x4'),_0xde41('0x5'),_0xde41('0x6'),'openchannel'];exports[_0xde41('0x7')]=function(){return channels;};exports['isValidChannel']=function(_0x11d813){_0x11d813=_0x11d813['toLowerCase']();return _[_0xde41('0x8')](channels,_0x11d813);};exports['clearBlockUser']=function(_0x2792ed,_0xf6a507,_0x1aca6e,_0x2bfedd){var _0x1c7b84={'loginAttempts':_0xf6a507,'blocked':_0x1aca6e};if(!_[_0xde41('0x9')](_0x2bfedd)){_0x1c7b84[_0xde41('0xa')]=_0x2bfedd;}return _0x2792ed[_0xde41('0xb')](_0x1c7b84);};exports[_0xde41('0xc')]=function(_0x49dd2d){return new BPromise(function(_0x54752e,_0x591d0f){var _0x148758=0x0;if(_0x49dd2d['role']!=='agent'){_0x54752e(_0x49dd2d);}db[_0xde41('0xd')][_0xde41('0xe')]({'where':{'role':_0xde41('0xf'),'online':!![],'id':{'$ne':_0x49dd2d['id']}}})[_0xde41('0x10')](function(_0x17f3a5){_0x148758=_0x17f3a5;return util[_0xde41('0xc')]();})[_0xde41('0x10')](function(_0x242e30){if(_0x242e30&&_0x242e30['agents']&&_0x148758>=_0x242e30[_0xde41('0x11')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x54752e(_0x49dd2d);})[_0xde41('0x12')](function(_0x5198be){_0x591d0f(_0x5198be);});});};
\ No newline at end of file