Built motion from commit (unavailable).|2.5.23
[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 _0xe46e=['openchannel','isValidChannel','includes','isUndefined','blockedAt','updateAttributes','getLicense','agent','User','count','then','agents','catch','lodash','bluebird','../mysqldb','./license/util','fax','sms','whatsapp'];(function(_0x7dff7d,_0x34e4ea){var _0x25b6f1=function(_0x4daef1){while(--_0x4daef1){_0x7dff7d['push'](_0x7dff7d['shift']());}};_0x25b6f1(++_0x34e4ea);}(_0xe46e,0xe9));var _0xee46=function(_0x4b4023,_0x2e2076){_0x4b4023=_0x4b4023-0x0;var _0x1eca57=_0xe46e[_0x4b4023];return _0x1eca57;};'use strict';var _=require(_0xee46('0x0'));var BPromise=require(_0xee46('0x1'));var db=require(_0xee46('0x2'))['db'];var util=require(_0xee46('0x3'));var channels=['voice','mail','chat',_0xee46('0x4'),_0xee46('0x5'),_0xee46('0x6'),_0xee46('0x7')];exports['getChannels']=function(){return channels;};exports[_0xee46('0x8')]=function(_0x590903){_0x590903=_0x590903['toLowerCase']();return _[_0xee46('0x9')](channels,_0x590903);};exports['clearBlockUser']=function(_0x2b1b09,_0x571acf,_0x3d1b78,_0x296ca9){var _0x37db6d={'loginAttempts':_0x571acf,'blocked':_0x3d1b78};if(!_[_0xee46('0xa')](_0x296ca9)){_0x37db6d[_0xee46('0xb')]=_0x296ca9;}return _0x2b1b09[_0xee46('0xc')](_0x37db6d);};exports[_0xee46('0xd')]=function(_0x326748){return new BPromise(function(_0x4c78ef,_0x3f767d){var _0x15766c=0x0;if(_0x326748['role']!==_0xee46('0xe')){_0x4c78ef(_0x326748);}db[_0xee46('0xf')][_0xee46('0x10')]({'where':{'role':_0xee46('0xe'),'online':!![],'id':{'$ne':_0x326748['id']}}})[_0xee46('0x11')](function(_0x5d1a42){_0x15766c=_0x5d1a42;return util[_0xee46('0xd')]();})['then'](function(_0x5b4664){if(_0x5b4664&&_0x5b4664[_0xee46('0x12')]&&_0x15766c>=_0x5b4664[_0xee46('0x12')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x4c78ef(_0x326748);})[_0xee46('0x13')](function(_0x56b65a){_0x3f767d(_0x56b65a);});});};