1 // *************************************************************************
3 // * xCALLY Motion - The Omnichannel Contact Center *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved *
6 // *************************************************************************
8 // * Email: info@xcally.com *
9 // * Website: https://www.xcally.com *
11 // *************************************************************************
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. *
17 // *************************************************************************
18 var _0x80c3=['Agents','waiting','md5','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','loggedIn','paused','online','available','stringify','format','emit','mail_queue:save','exports','lodash','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall'];(function(_0x170de1,_0x327023){var _0x29c29a=function(_0x167e34){while(--_0x167e34){_0x170de1['push'](_0x170de1['shift']());}};_0x29c29a(++_0x327023);}(_0x80c3,0x1a7));var _0x380c=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x80c3[_0x47b58b];return _0x46bebe;};'use strict';var _=require(_0x380c('0x0'));var md5=require('md5');var util=require(_0x380c('0x1'));var Redis=require(_0x380c('0x2'));var config=require(_0x380c('0x3'));config['redis']=_[_0x380c('0x4')](config[_0x380c('0x5')],{'host':_0x380c('0x6'),'port':0x18eb});var io=require(_0x380c('0x7'))(new Redis(config['redis']));function MailQueue(_0x55e874){this['id']=_0x55e874['id']||0x0;this[_0x380c('0x8')]=_0x55e874[_0x380c('0x8')]||'';this[_0x380c('0x9')]=_0x55e874[_0x380c('0x9')]||0xa;this[_0x380c('0xa')]=_0x55e874[_0x380c('0xa')]||_0x380c('0xb');this[_0x380c('0xc')]=_0x55e874[_0x380c('0xc')];this['mapAgentsId']={};this[_0x380c('0xd')]=0x0;this[_0x380c('0xe')]='';this[_0x380c('0xf')]();this[_0x380c('0x10')]();}MailQueue[_0x380c('0x11')][_0x380c('0xf')]=function(){var _0x3609f9=this[_0x380c('0x12')][_0x380c('0x13')];this[_0x380c('0x12')]=_['map'](this['Agents'],'id');this[_0x380c('0x12')][_0x380c('0x13')]=_0x3609f9;};MailQueue[_0x380c('0x11')][_0x380c('0x10')]=function(){this[_0x380c('0x14')]=0x0;this[_0x380c('0x15')]=0x0;for(var _0x4bf3ec=0x0;_0x4bf3ec<this[_0x380c('0xc')]['length'];_0x4bf3ec+=0x1){if(this[_0x380c('0xc')][_0x4bf3ec][_0x380c('0x16')]){this['loggedIn']+=0x1;}if(this[_0x380c('0xc')][_0x4bf3ec]['mailPause']){this[_0x380c('0x15')]+=0x1;}}this[_0x380c('0x17')]=this[_0x380c('0x14')]-this[_0x380c('0x15')];this[_0x380c('0x17')]=this[_0x380c('0x17')]>=0x0?this[_0x380c('0x17')]:0x0;var _0x2694e4={'id':this['id'],'available':this[_0x380c('0x17')],'loggedIn':this[_0x380c('0x14')],'name':this[_0x380c('0x8')],'paused':this[_0x380c('0x15')],'waiting':this['waiting']};var _0x1a319b=md5(JSON[_0x380c('0x18')](_0x2694e4));if(this[_0x380c('0xe')]!==_0x1a319b){this[_0x380c('0xe')]=_0x1a319b;io['to'](util[_0x380c('0x19')]('mail:queue:%s',_0x2694e4['name']))[_0x380c('0x1a')](_0x380c('0x1b'),_0x2694e4);}};module[_0x380c('0x1c')]=MailQueue;