Built motion from commit 3c2ce842.|2.6.31
[motion2.git] / server / config / utils.js
index 21018f7..ecd7ad7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e8=['voice','chat','fax','sms','whatsapp','openchannel','getChannels','isValidChannel','includes','clearBlockUser','updateAttributes','User','count','then','getLicense','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','bluebird','../mysqldb','./license/util'];(function(_0x37cc52,_0x459a9b){var _0x2b4a90=function(_0xabcfc7){while(--_0xabcfc7){_0x37cc52['push'](_0x37cc52['shift']());}};_0x2b4a90(++_0x459a9b);}(_0xa9e8,0xe3));var _0x8a9e=function(_0x4768dc,_0x2f5014){_0x4768dc=_0x4768dc-0x0;var _0x1c75cc=_0xa9e8[_0x4768dc];return _0x1c75cc;};'use strict';var _=require(_0x8a9e('0x0'));var BPromise=require(_0x8a9e('0x1'));var db=require(_0x8a9e('0x2'))['db'];var util=require(_0x8a9e('0x3'));var channels=[_0x8a9e('0x4'),'mail',_0x8a9e('0x5'),_0x8a9e('0x6'),_0x8a9e('0x7'),_0x8a9e('0x8'),_0x8a9e('0x9')];exports[_0x8a9e('0xa')]=function(){return channels;};exports[_0x8a9e('0xb')]=function(_0x27b2fb){_0x27b2fb=_0x27b2fb['toLowerCase']();return _[_0x8a9e('0xc')](channels,_0x27b2fb);};exports[_0x8a9e('0xd')]=function(_0x1efdf9,_0x15275f,_0x389ea7,_0x590cfe){var _0x6c62ee={'loginAttempts':_0x15275f,'blocked':_0x389ea7};if(!_['isUndefined'](_0x590cfe)){_0x6c62ee['blockedAt']=_0x590cfe;}return _0x1efdf9[_0x8a9e('0xe')](_0x6c62ee);};exports['getLicense']=function(_0x4e2a9f){return new BPromise(function(_0x184923,_0x86fc92){var _0x4af8b5=0x0;if(_0x4e2a9f['role']!=='agent'){_0x184923(_0x4e2a9f);}db[_0x8a9e('0xf')][_0x8a9e('0x10')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x4e2a9f['id']}}})[_0x8a9e('0x11')](function(_0x1c283f){_0x4af8b5=_0x1c283f;return util[_0x8a9e('0x12')]();})[_0x8a9e('0x11')](function(_0x807780){if(_0x807780&&_0x807780['agents']&&_0x4af8b5>=_0x807780['agents']){throw Error(_0x8a9e('0x13'));}_0x184923(_0x4e2a9f);})[_0x8a9e('0x14')](function(_0x26ee35){_0x86fc92(_0x26ee35);});});};
\ No newline at end of file
+var _0x36e1=['updateAttributes','getLicense','agent','User','count','then','agents','Maximum\x20login\x20has\x20been\x20reached','bluebird','../mysqldb','voice','mail','chat','sms','openchannel','getChannels','isValidChannel','toLowerCase','clearBlockUser','isUndefined','blockedAt'];(function(_0x3ff517,_0x23a8d6){var _0x10337c=function(_0x410fb6){while(--_0x410fb6){_0x3ff517['push'](_0x3ff517['shift']());}};_0x10337c(++_0x23a8d6);}(_0x36e1,0xc5));var _0x136e=function(_0x4c184d,_0x4278ab){_0x4c184d=_0x4c184d-0x0;var _0x23d997=_0x36e1[_0x4c184d];return _0x23d997;};'use strict';var _=require('lodash');var BPromise=require(_0x136e('0x0'));var db=require(_0x136e('0x1'))['db'];var util=require('./license/util');var channels=[_0x136e('0x2'),_0x136e('0x3'),_0x136e('0x4'),'fax',_0x136e('0x5'),'whatsapp',_0x136e('0x6')];exports[_0x136e('0x7')]=function(){return channels;};exports[_0x136e('0x8')]=function(_0x55eee0){_0x55eee0=_0x55eee0[_0x136e('0x9')]();return _['includes'](channels,_0x55eee0);};exports[_0x136e('0xa')]=function(_0x48b343,_0x3ebdc2,_0x484083,_0xff484e){var _0x4dfab5={'loginAttempts':_0x3ebdc2,'blocked':_0x484083};if(!_[_0x136e('0xb')](_0xff484e)){_0x4dfab5[_0x136e('0xc')]=_0xff484e;}return _0x48b343[_0x136e('0xd')](_0x4dfab5);};exports[_0x136e('0xe')]=function(_0x49df48){return new BPromise(function(_0x103e17,_0x2e20e2){var _0x9026ae=0x0;if(_0x49df48['role']!==_0x136e('0xf')){_0x103e17(_0x49df48);}db[_0x136e('0x10')][_0x136e('0x11')]({'where':{'role':_0x136e('0xf'),'online':!![],'id':{'$ne':_0x49df48['id']}}})[_0x136e('0x12')](function(_0x22533c){_0x9026ae=_0x22533c;return util[_0x136e('0xe')]();})['then'](function(_0x21223e){if(_0x21223e&&_0x21223e[_0x136e('0x13')]&&_0x9026ae>=_0x21223e[_0x136e('0x13')]){throw Error(_0x136e('0x14'));}_0x103e17(_0x49df48);})['catch'](function(_0x1b7148){_0x2e20e2(_0x1b7148);});});};
\ No newline at end of file