Built motion from commit 1ea47bf4.|2.6.34
[motion2.git] / server / config / utils.js
index d773f93..aa3df95 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb524=['then','agents','Maximum\x20login\x20has\x20been\x20reached','lodash','../mysqldb','voice','mail','chat','fax','sms','whatsapp','openchannel','toLowerCase','includes','isUndefined','blockedAt','updateAttributes','getLicense','role','User','count','agent'];(function(_0x359058,_0x2175a3){var _0x9ced29=function(_0x53f1bc){while(--_0x53f1bc){_0x359058['push'](_0x359058['shift']());}};_0x9ced29(++_0x2175a3);}(_0xb524,0xc9));var _0x4b52=function(_0x5c90ea,_0x457b03){_0x5c90ea=_0x5c90ea-0x0;var _0x2620fb=_0xb524[_0x5c90ea];return _0x2620fb;};'use strict';var _=require(_0x4b52('0x0'));var BPromise=require('bluebird');var db=require(_0x4b52('0x1'))['db'];var util=require('./license/util');var channels=[_0x4b52('0x2'),_0x4b52('0x3'),_0x4b52('0x4'),_0x4b52('0x5'),_0x4b52('0x6'),_0x4b52('0x7'),_0x4b52('0x8')];exports['getChannels']=function(){return channels;};exports['isValidChannel']=function(_0xd4e7e6){_0xd4e7e6=_0xd4e7e6[_0x4b52('0x9')]();return _[_0x4b52('0xa')](channels,_0xd4e7e6);};exports['clearBlockUser']=function(_0x3edd93,_0x49dbec,_0x272483,_0x576ffb){var _0x4e09cd={'loginAttempts':_0x49dbec,'blocked':_0x272483};if(!_[_0x4b52('0xb')](_0x576ffb)){_0x4e09cd[_0x4b52('0xc')]=_0x576ffb;}return _0x3edd93[_0x4b52('0xd')](_0x4e09cd);};exports[_0x4b52('0xe')]=function(_0x1f8e99){return new BPromise(function(_0x253e66,_0x558f1b){var _0x3657ce=0x0;if(_0x1f8e99[_0x4b52('0xf')]!=='agent'){_0x253e66(_0x1f8e99);}db[_0x4b52('0x10')][_0x4b52('0x11')]({'where':{'role':_0x4b52('0x12'),'online':!![],'id':{'$ne':_0x1f8e99['id']}}})[_0x4b52('0x13')](function(_0x4b7900){_0x3657ce=_0x4b7900;return util[_0x4b52('0xe')]();})[_0x4b52('0x13')](function(_0x59156b){if(_0x59156b&&_0x59156b[_0x4b52('0x14')]&&_0x3657ce>=_0x59156b[_0x4b52('0x14')]){throw Error(_0x4b52('0x15'));}_0x253e66(_0x1f8e99);})['catch'](function(_0x506a1c){_0x558f1b(_0x506a1c);});});};
\ No newline at end of file
+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