Built motion from commit d13fb11b.|2.6.34
[motion2.git] / server / config / utils.js
index aa3df95..84e7158 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6a57=['chat','fax','sms','whatsapp','openchannel','getChannels','isValidChannel','includes','clearBlockUser','isUndefined','blockedAt','updateAttributes','getLicense','role','count','agent','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','../mysqldb','./license/util','voice'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6a57,0x13f));var _0x76a5=function(_0x21b0ef,_0x2bec64){_0x21b0ef=_0x21b0ef-0x0;var _0x135500=_0x6a57[_0x21b0ef];return _0x135500;};'use strict';var _=require('lodash');var BPromise=require('bluebird');var db=require(_0x76a5('0x0'))['db'];var util=require(_0x76a5('0x1'));var channels=[_0x76a5('0x2'),'mail',_0x76a5('0x3'),_0x76a5('0x4'),_0x76a5('0x5'),_0x76a5('0x6'),_0x76a5('0x7')];exports[_0x76a5('0x8')]=function(){return channels;};exports[_0x76a5('0x9')]=function(_0x1d9376){_0x1d9376=_0x1d9376['toLowerCase']();return _[_0x76a5('0xa')](channels,_0x1d9376);};exports[_0x76a5('0xb')]=function(_0xe8a53b,_0x221bbb,_0x3f9182,_0xa76b06){var _0x192ac9={'loginAttempts':_0x221bbb,'blocked':_0x3f9182};if(!_[_0x76a5('0xc')](_0xa76b06)){_0x192ac9[_0x76a5('0xd')]=_0xa76b06;}return _0xe8a53b[_0x76a5('0xe')](_0x192ac9);};exports[_0x76a5('0xf')]=function(_0x3fa01a){return new BPromise(function(_0x28b026,_0x11b619){var _0x3977e9=0x0;if(_0x3fa01a[_0x76a5('0x10')]!=='agent'){_0x28b026(_0x3fa01a);}db['User'][_0x76a5('0x11')]({'where':{'role':_0x76a5('0x12'),'online':!![],'id':{'$ne':_0x3fa01a['id']}}})[_0x76a5('0x13')](function(_0x1df477){_0x3977e9=_0x1df477;return util[_0x76a5('0xf')]();})['then'](function(_0x11814a){if(_0x11814a&&_0x11814a[_0x76a5('0x14')]&&_0x3977e9>=_0x11814a[_0x76a5('0x14')]){throw Error(_0x76a5('0x15'));}_0x28b026(_0x3fa01a);})[_0x76a5('0x16')](function(_0x350452){_0x11b619(_0x350452);});});};
\ No newline at end of file
+var _0xf355=['catch','lodash','bluebird','../mysqldb','voice','mail','chat','fax','sms','getChannels','isValidChannel','includes','clearBlockUser','isUndefined','blockedAt','updateAttributes','getLicense','agent','User','count','then','Maximum\x20login\x20has\x20been\x20reached'];(function(_0x25efc3,_0x555aae){var _0x4d3891=function(_0x149c0a){while(--_0x149c0a){_0x25efc3['push'](_0x25efc3['shift']());}};_0x4d3891(++_0x555aae);}(_0xf355,0xc7));var _0x5f35=function(_0x43b9a6,_0x1c6137){_0x43b9a6=_0x43b9a6-0x0;var _0x447cd4=_0xf355[_0x43b9a6];return _0x447cd4;};'use strict';var _=require(_0x5f35('0x0'));var BPromise=require(_0x5f35('0x1'));var db=require(_0x5f35('0x2'))['db'];var util=require('./license/util');var channels=[_0x5f35('0x3'),_0x5f35('0x4'),_0x5f35('0x5'),_0x5f35('0x6'),_0x5f35('0x7'),'whatsapp','openchannel'];exports[_0x5f35('0x8')]=function(){return channels;};exports[_0x5f35('0x9')]=function(_0x31ccec){_0x31ccec=_0x31ccec['toLowerCase']();return _[_0x5f35('0xa')](channels,_0x31ccec);};exports[_0x5f35('0xb')]=function(_0x3c5b9c,_0x3cd84a,_0x2beb1b,_0x71f37a){var _0x93da03={'loginAttempts':_0x3cd84a,'blocked':_0x2beb1b};if(!_[_0x5f35('0xc')](_0x71f37a)){_0x93da03[_0x5f35('0xd')]=_0x71f37a;}return _0x3c5b9c[_0x5f35('0xe')](_0x93da03);};exports[_0x5f35('0xf')]=function(_0x18937b){return new BPromise(function(_0x1cfba2,_0x29db29){var _0x1df809=0x0;if(_0x18937b['role']!==_0x5f35('0x10')){_0x1cfba2(_0x18937b);}db[_0x5f35('0x11')][_0x5f35('0x12')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x18937b['id']}}})[_0x5f35('0x13')](function(_0x229cb3){_0x1df809=_0x229cb3;return util[_0x5f35('0xf')]();})['then'](function(_0x57a423){if(_0x57a423&&_0x57a423['agents']&&_0x1df809>=_0x57a423['agents']){throw Error(_0x5f35('0x14'));}_0x1cfba2(_0x18937b);})[_0x5f35('0x15')](function(_0x4cc167){_0x29db29(_0x4cc167);});});};
\ No newline at end of file