Built motion from commit d5e4af8c.|2.6.23
[motion2.git] / server / config / utils.js
index 0ca4529..a339715 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x12e2=['chat','fax','sms','whatsapp','openchannel','getChannels','isValidChannel','includes','clearBlockUser','isUndefined','blockedAt','updateAttributes','getLicense','role','agent','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','../mysqldb','./license/util','voice'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x12e2,0xcb));var _0x212e=function(_0x5096f2,_0x428e9e){_0x5096f2=_0x5096f2-0x0;var _0x1200b4=_0x12e2[_0x5096f2];return _0x1200b4;};'use strict';var _=require(_0x212e('0x0'));var BPromise=require('bluebird');var db=require(_0x212e('0x1'))['db'];var util=require(_0x212e('0x2'));var channels=[_0x212e('0x3'),'mail',_0x212e('0x4'),_0x212e('0x5'),_0x212e('0x6'),_0x212e('0x7'),_0x212e('0x8')];exports[_0x212e('0x9')]=function(){return channels;};exports[_0x212e('0xa')]=function(_0x4a8fcc){_0x4a8fcc=_0x4a8fcc['toLowerCase']();return _[_0x212e('0xb')](channels,_0x4a8fcc);};exports[_0x212e('0xc')]=function(_0x3f184d,_0x994f9d,_0x1301f6,_0x69a5d){var _0xd1e322={'loginAttempts':_0x994f9d,'blocked':_0x1301f6};if(!_[_0x212e('0xd')](_0x69a5d)){_0xd1e322[_0x212e('0xe')]=_0x69a5d;}return _0x3f184d[_0x212e('0xf')](_0xd1e322);};exports[_0x212e('0x10')]=function(_0x1fb6f7){return new BPromise(function(_0x2e614e,_0x95fffc){var _0x4095cb=0x0;if(_0x1fb6f7[_0x212e('0x11')]!==_0x212e('0x12')){_0x2e614e(_0x1fb6f7);}db['User']['count']({'where':{'role':_0x212e('0x12'),'online':!![],'id':{'$ne':_0x1fb6f7['id']}}})['then'](function(_0x4e5741){_0x4095cb=_0x4e5741;return util[_0x212e('0x10')]();})[_0x212e('0x13')](function(_0x111f50){if(_0x111f50&&_0x111f50[_0x212e('0x14')]&&_0x4095cb>=_0x111f50[_0x212e('0x14')]){throw Error(_0x212e('0x15'));}_0x2e614e(_0x1fb6f7);})[_0x212e('0x16')](function(_0x4392cb){_0x95fffc(_0x4392cb);});});};
\ No newline at end of file
+var _0xa086=['Maximum\x20login\x20has\x20been\x20reached','catch','lodash','bluebird','../mysqldb','./license/util','voice','mail','chat','fax','sms','openchannel','getChannels','isValidChannel','toLowerCase','includes','clearBlockUser','isUndefined','blockedAt','updateAttributes','getLicense','role','agent','User','count','then','agents'];(function(_0x2d85a5,_0x26861c){var _0x27d75b=function(_0x46c938){while(--_0x46c938){_0x2d85a5['push'](_0x2d85a5['shift']());}};_0x27d75b(++_0x26861c);}(_0xa086,0xf5));var _0x6a08=function(_0x3a1dad,_0x2d3403){_0x3a1dad=_0x3a1dad-0x0;var _0xe3be62=_0xa086[_0x3a1dad];return _0xe3be62;};'use strict';var _=require(_0x6a08('0x0'));var BPromise=require(_0x6a08('0x1'));var db=require(_0x6a08('0x2'))['db'];var util=require(_0x6a08('0x3'));var channels=[_0x6a08('0x4'),_0x6a08('0x5'),_0x6a08('0x6'),_0x6a08('0x7'),_0x6a08('0x8'),'whatsapp',_0x6a08('0x9')];exports[_0x6a08('0xa')]=function(){return channels;};exports[_0x6a08('0xb')]=function(_0x24783a){_0x24783a=_0x24783a[_0x6a08('0xc')]();return _[_0x6a08('0xd')](channels,_0x24783a);};exports[_0x6a08('0xe')]=function(_0x6cf6f6,_0x183c96,_0x458aab,_0x2a4f4b){var _0x3f1f0c={'loginAttempts':_0x183c96,'blocked':_0x458aab};if(!_[_0x6a08('0xf')](_0x2a4f4b)){_0x3f1f0c[_0x6a08('0x10')]=_0x2a4f4b;}return _0x6cf6f6[_0x6a08('0x11')](_0x3f1f0c);};exports[_0x6a08('0x12')]=function(_0x245f1d){return new BPromise(function(_0x46e223,_0x2d2160){var _0x49f164=0x0;if(_0x245f1d[_0x6a08('0x13')]!==_0x6a08('0x14')){_0x46e223(_0x245f1d);}db[_0x6a08('0x15')][_0x6a08('0x16')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x245f1d['id']}}})[_0x6a08('0x17')](function(_0x15b911){_0x49f164=_0x15b911;return util[_0x6a08('0x12')]();})[_0x6a08('0x17')](function(_0x27f78b){if(_0x27f78b&&_0x27f78b[_0x6a08('0x18')]&&_0x49f164>=_0x27f78b['agents']){throw Error(_0x6a08('0x19'));}_0x46e223(_0x245f1d);})[_0x6a08('0x1a')](function(_0x91717){_0x2d2160(_0x91717);});});};
\ No newline at end of file