Built motion from commit (unavailable).|2.5.4
[motion2.git] / server / config / utils.js
1 // *************************************************************************
2 // *                                                                       *
3 // * xCALLY Motion -  The Omnichannel Contact Center                       *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved                     *
5 // *                                                                       *
6 // *************************************************************************
7 // *                                                                       *
8 // * Email: info@xcally.com                                                *
9 // * Website: https://www.xcally.com                                       *
10 // *                                                                       *
11 // *************************************************************************
12 // *                                                                       *
13 // * The SOFTWARE PRODUCT is protected by copyright laws and international *
14 // * copyright treaties, as well as other intellectual property laws and   *
15 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                         *
16 // *                                                                       *
17 // *************************************************************************
18 var _0xc4c4=['agent','User','count','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','../mysqldb','./license/util','chat','fax','sms','whatsapp','openchannel','getChannels','isValidChannel','toLowerCase','includes','clearBlockUser','isUndefined','blockedAt','updateAttributes','getLicense'];(function(_0xc07a5e,_0xf476b3){var _0x57d95a=function(_0x1c6f55){while(--_0x1c6f55){_0xc07a5e['push'](_0xc07a5e['shift']());}};_0x57d95a(++_0xf476b3);}(_0xc4c4,0x18e));var _0x4c4c=function(_0x5ac0f0,_0xee4d98){_0x5ac0f0=_0x5ac0f0-0x0;var _0x4aceec=_0xc4c4[_0x5ac0f0];return _0x4aceec;};'use strict';var _=require('lodash');var BPromise=require('bluebird');var db=require(_0x4c4c('0x0'))['db'];var util=require(_0x4c4c('0x1'));var channels=['voice','mail',_0x4c4c('0x2'),_0x4c4c('0x3'),_0x4c4c('0x4'),_0x4c4c('0x5'),_0x4c4c('0x6')];exports[_0x4c4c('0x7')]=function(){return channels;};exports[_0x4c4c('0x8')]=function(_0x1cbbfe){_0x1cbbfe=_0x1cbbfe[_0x4c4c('0x9')]();return _[_0x4c4c('0xa')](channels,_0x1cbbfe);};exports[_0x4c4c('0xb')]=function(_0x1baae1,_0x50c1c8,_0x401faa,_0x276902){var _0x4161f8={'loginAttempts':_0x50c1c8,'blocked':_0x401faa};if(!_[_0x4c4c('0xc')](_0x276902)){_0x4161f8[_0x4c4c('0xd')]=_0x276902;}return _0x1baae1[_0x4c4c('0xe')](_0x4161f8);};exports[_0x4c4c('0xf')]=function(_0x4a85ca){return new BPromise(function(_0x47efef,_0x12783a){var _0x1e2582=0x0;if(_0x4a85ca['role']!==_0x4c4c('0x10')){_0x47efef(_0x4a85ca);}db[_0x4c4c('0x11')][_0x4c4c('0x12')]({'where':{'role':_0x4c4c('0x10'),'online':!![],'id':{'$ne':_0x4a85ca['id']}}})[_0x4c4c('0x13')](function(_0x4a5b4b){_0x1e2582=_0x4a5b4b;return util[_0x4c4c('0xf')]();})[_0x4c4c('0x13')](function(_0x3bb192){if(_0x3bb192&&_0x3bb192[_0x4c4c('0x14')]&&_0x1e2582>=_0x3bb192['agents']){throw Error(_0x4c4c('0x15'));}_0x47efef(_0x4a85ca);})[_0x4c4c('0x16')](function(_0x3de54c){_0x12783a(_0x3de54c);});});};