Built motion from commit (unavailable).|2.5.1
[motion2.git] / server / services / routing / model / mailQueue.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 _0x605b=['strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','map','loggedIn','paused','length','online','mailPause','available','stringify','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','util','ioredis','redis','localhost','name','timeout'];(function(_0x1eedfb,_0x4e8c25){var _0x5e6b75=function(_0x10f964){while(--_0x10f964){_0x1eedfb['push'](_0x1eedfb['shift']());}};_0x5e6b75(++_0x4e8c25);}(_0x605b,0xf4));var _0xb605=function(_0x486a0e,_0x373f76){_0x486a0e=_0x486a0e-0x0;var _0x4aad97=_0x605b[_0x486a0e];return _0x4aad97;};'use strict';var _=require(_0xb605('0x0'));var md5=require(_0xb605('0x1'));var util=require(_0xb605('0x2'));var Redis=require(_0xb605('0x3'));var config=require('../../../config/environment');config[_0xb605('0x4')]=_['defaults'](config['redis'],{'host':_0xb605('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb605('0x4')]));function MailQueue(_0x15f8a9){this['id']=_0x15f8a9['id']||0x0;this[_0xb605('0x6')]=_0x15f8a9['name']||'';this[_0xb605('0x7')]=_0x15f8a9[_0xb605('0x7')]||0xa;this[_0xb605('0x8')]=_0x15f8a9[_0xb605('0x8')]||_0xb605('0x9');this[_0xb605('0xa')]=_0x15f8a9[_0xb605('0xa')];this[_0xb605('0xb')]={};this[_0xb605('0xc')]=0x0;this[_0xb605('0x1')]='';this[_0xb605('0xd')]();this['updateRealtime']();}MailQueue[_0xb605('0xe')][_0xb605('0xd')]=function(){var _0x485cea=this[_0xb605('0xb')]['_rr'];this[_0xb605('0xb')]=_[_0xb605('0xf')](this[_0xb605('0xa')],'id');this[_0xb605('0xb')]['_rr']=_0x485cea;};MailQueue[_0xb605('0xe')]['updateRealtime']=function(){this[_0xb605('0x10')]=0x0;this[_0xb605('0x11')]=0x0;for(var _0x2b740c=0x0;_0x2b740c<this[_0xb605('0xa')][_0xb605('0x12')];_0x2b740c+=0x1){if(this[_0xb605('0xa')][_0x2b740c][_0xb605('0x13')]){this[_0xb605('0x10')]+=0x1;}if(this[_0xb605('0xa')][_0x2b740c][_0xb605('0x14')]){this[_0xb605('0x11')]+=0x1;}}this[_0xb605('0x15')]=this['loggedIn']-this[_0xb605('0x11')];this[_0xb605('0x15')]=this[_0xb605('0x15')]>=0x0?this[_0xb605('0x15')]:0x0;var _0x251829={'id':this['id'],'available':this[_0xb605('0x15')],'loggedIn':this['loggedIn'],'name':this[_0xb605('0x6')],'paused':this[_0xb605('0x11')],'waiting':this['waiting']};var _0x131ce3=md5(JSON[_0xb605('0x16')](_0x251829));if(this[_0xb605('0x1')]!==_0x131ce3){this[_0xb605('0x1')]=_0x131ce3;io['to'](util[_0xb605('0x17')](_0xb605('0x18'),_0x251829['name']))[_0xb605('0x19')](_0xb605('0x1a'),_0x251829);}};module[_0xb605('0x1b')]=MailQueue;