Built motion from commit (unavailable).|2.5.21
[motion2.git] / server / services / routing / model / whatsappQueue.js
index 4a9e960..a2ba85d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7a8c=['strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','paused','whatsappPause','loggedIn','available','stringify','format','whatsapp:queue:%s','whatsapp_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout'];(function(_0x4ee9f4,_0x484733){var _0x4a80cb=function(_0x5a0490){while(--_0x5a0490){_0x4ee9f4['push'](_0x4ee9f4['shift']());}};_0x4a80cb(++_0x484733);}(_0x7a8c,0x146));var _0xc7a8=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0x7a8c[_0x88cd7b];return _0x56fcc8;};'use strict';var _=require(_0xc7a8('0x0'));var md5=require(_0xc7a8('0x1'));var util=require(_0xc7a8('0x2'));var Redis=require(_0xc7a8('0x3'));var config=require(_0xc7a8('0x4'));config[_0xc7a8('0x5')]=_[_0xc7a8('0x6')](config['redis'],{'host':_0xc7a8('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc7a8('0x5')]));function WhatsappQueue(_0x5545bc){this['id']=_0x5545bc['id']||0x0;this['name']=_0x5545bc[_0xc7a8('0x8')]||'';this[_0xc7a8('0x9')]=_0x5545bc['timeout']||0xa;this[_0xc7a8('0xa')]=_0x5545bc['strategy']||_0xc7a8('0xb');this[_0xc7a8('0xc')]=_0x5545bc['Agents'];this[_0xc7a8('0xd')]={};this[_0xc7a8('0xe')]=0x0;this[_0xc7a8('0x1')]='';this[_0xc7a8('0xf')]();this[_0xc7a8('0x10')]();}WhatsappQueue[_0xc7a8('0x11')]['updateRouting']=function(){var _0x283d93=this[_0xc7a8('0xd')][_0xc7a8('0x12')];this[_0xc7a8('0xd')]=_['map'](this['Agents'],'id');this[_0xc7a8('0xd')][_0xc7a8('0x12')]=_0x283d93;};WhatsappQueue['prototype']['updateRealtime']=function(){this['loggedIn']=0x0;this[_0xc7a8('0x13')]=0x0;for(var _0x599870=0x0;_0x599870<this['Agents']['length'];_0x599870+=0x1){if(this[_0xc7a8('0xc')][_0x599870]['online']){this['loggedIn']+=0x1;}if(this[_0xc7a8('0xc')][_0x599870][_0xc7a8('0x14')]){this[_0xc7a8('0x13')]+=0x1;}}this['available']=this[_0xc7a8('0x15')]-this['paused'];this[_0xc7a8('0x16')]=this[_0xc7a8('0x16')]>=0x0?this['available']:0x0;var _0x59cdb3={'id':this['id'],'available':this[_0xc7a8('0x16')],'loggedIn':this[_0xc7a8('0x15')],'name':this['name'],'paused':this[_0xc7a8('0x13')],'waiting':this[_0xc7a8('0xe')]};var _0x4081af=md5(JSON[_0xc7a8('0x17')](_0x59cdb3));if(this[_0xc7a8('0x1')]!==_0x4081af){this[_0xc7a8('0x1')]=_0x4081af;io['to'](util[_0xc7a8('0x18')](_0xc7a8('0x19'),_0x59cdb3[_0xc7a8('0x8')]))['emit'](_0xc7a8('0x1a'),_0x59cdb3);}};module[_0xc7a8('0x1b')]=WhatsappQueue;
\ No newline at end of file
+var _0x141a=['waiting','updateRouting','updateRealtime','map','_rr','prototype','loggedIn','paused','length','whatsappPause','available','stringify','format','whatsapp_queue:save','exports','lodash','md5','util','redis','defaults','name','timeout','strategy','beepall','Agents','mapAgentsId'];(function(_0x484432,_0x132d67){var _0x4ff446=function(_0x5c82af){while(--_0x5c82af){_0x484432['push'](_0x484432['shift']());}};_0x4ff446(++_0x132d67);}(_0x141a,0xf9));var _0xa141=function(_0x4c7d67,_0x4f47c8){_0x4c7d67=_0x4c7d67-0x0;var _0x4b2781=_0x141a[_0x4c7d67];return _0x4b2781;};'use strict';var _=require(_0xa141('0x0'));var md5=require(_0xa141('0x1'));var util=require(_0xa141('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0xa141('0x3')]=_[_0xa141('0x4')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa141('0x3')]));function WhatsappQueue(_0x144a75){this['id']=_0x144a75['id']||0x0;this[_0xa141('0x5')]=_0x144a75['name']||'';this[_0xa141('0x6')]=_0x144a75[_0xa141('0x6')]||0xa;this[_0xa141('0x7')]=_0x144a75[_0xa141('0x7')]||_0xa141('0x8');this[_0xa141('0x9')]=_0x144a75['Agents'];this[_0xa141('0xa')]={};this[_0xa141('0xb')]=0x0;this['md5']='';this[_0xa141('0xc')]();this[_0xa141('0xd')]();}WhatsappQueue['prototype'][_0xa141('0xc')]=function(){var _0xfffa9c=this[_0xa141('0xa')]['_rr'];this[_0xa141('0xa')]=_[_0xa141('0xe')](this[_0xa141('0x9')],'id');this[_0xa141('0xa')][_0xa141('0xf')]=_0xfffa9c;};WhatsappQueue[_0xa141('0x10')][_0xa141('0xd')]=function(){this[_0xa141('0x11')]=0x0;this[_0xa141('0x12')]=0x0;for(var _0x10ce1e=0x0;_0x10ce1e<this[_0xa141('0x9')][_0xa141('0x13')];_0x10ce1e+=0x1){if(this['Agents'][_0x10ce1e]['online']){this[_0xa141('0x11')]+=0x1;}if(this[_0xa141('0x9')][_0x10ce1e][_0xa141('0x14')]){this['paused']+=0x1;}}this[_0xa141('0x15')]=this[_0xa141('0x11')]-this[_0xa141('0x12')];this[_0xa141('0x15')]=this[_0xa141('0x15')]>=0x0?this[_0xa141('0x15')]:0x0;var _0x3cc7d3={'id':this['id'],'available':this[_0xa141('0x15')],'loggedIn':this[_0xa141('0x11')],'name':this['name'],'paused':this[_0xa141('0x12')],'waiting':this[_0xa141('0xb')]};var _0x203374=md5(JSON[_0xa141('0x16')](_0x3cc7d3));if(this['md5']!==_0x203374){this[_0xa141('0x1')]=_0x203374;io['to'](util[_0xa141('0x17')]('whatsapp:queue:%s',_0x3cc7d3['name']))['emit'](_0xa141('0x18'),_0x3cc7d3);}};module[_0xa141('0x19')]=WhatsappQueue;
\ No newline at end of file