Built motion from commit 4e7c323b.|2.5.34
[motion2.git] / server / services / routing / model / whatsappQueue.js
index 9537dce..1f4ad2e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4cba=['ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','length','online','whatsappPause','available','loggedIn','paused','stringify','format','whatsapp_queue:save','lodash','md5','util'];(function(_0x14b21b,_0x20aadf){var _0x300ca2=function(_0x4881ea){while(--_0x4881ea){_0x14b21b['push'](_0x14b21b['shift']());}};_0x300ca2(++_0x20aadf);}(_0x4cba,0x1e3));var _0xa4cb=function(_0x24f019,_0x1145b0){_0x24f019=_0x24f019-0x0;var _0x135dcd=_0x4cba[_0x24f019];return _0x135dcd;};'use strict';var _=require(_0xa4cb('0x0'));var md5=require(_0xa4cb('0x1'));var util=require(_0xa4cb('0x2'));var Redis=require(_0xa4cb('0x3'));var config=require(_0xa4cb('0x4'));config[_0xa4cb('0x5')]=_['defaults'](config[_0xa4cb('0x5')],{'host':_0xa4cb('0x6'),'port':0x18eb});var io=require(_0xa4cb('0x7'))(new Redis(config['redis']));function WhatsappQueue(_0x3c4b9b){this['id']=_0x3c4b9b['id']||0x0;this[_0xa4cb('0x8')]=_0x3c4b9b['name']||'';this[_0xa4cb('0x9')]=_0x3c4b9b['timeout']||0xa;this[_0xa4cb('0xa')]=_0x3c4b9b[_0xa4cb('0xa')]||'beepall';this['Agents']=_0x3c4b9b[_0xa4cb('0xb')];this[_0xa4cb('0xc')]={};this[_0xa4cb('0xd')]=0x0;this['md5']='';this[_0xa4cb('0xe')]();this[_0xa4cb('0xf')]();}WhatsappQueue[_0xa4cb('0x10')]['updateRouting']=function(){var _0x4b21c5=this['mapAgentsId']['_rr'];this['mapAgentsId']=_[_0xa4cb('0x11')](this[_0xa4cb('0xb')],'id');this[_0xa4cb('0xc')]['_rr']=_0x4b21c5;};WhatsappQueue[_0xa4cb('0x10')]['updateRealtime']=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x3ca0a6=0x0;_0x3ca0a6<this[_0xa4cb('0xb')][_0xa4cb('0x12')];_0x3ca0a6+=0x1){if(this['Agents'][_0x3ca0a6][_0xa4cb('0x13')]){this['loggedIn']+=0x1;}if(this[_0xa4cb('0xb')][_0x3ca0a6][_0xa4cb('0x14')]){this['paused']+=0x1;}}this[_0xa4cb('0x15')]=this[_0xa4cb('0x16')]-this[_0xa4cb('0x17')];this[_0xa4cb('0x15')]=this['available']>=0x0?this['available']:0x0;var _0xfc2997={'id':this['id'],'available':this[_0xa4cb('0x15')],'loggedIn':this[_0xa4cb('0x16')],'name':this[_0xa4cb('0x8')],'paused':this[_0xa4cb('0x17')],'waiting':this[_0xa4cb('0xd')]};var _0x436d41=md5(JSON[_0xa4cb('0x18')](_0xfc2997));if(this['md5']!==_0x436d41){this[_0xa4cb('0x1')]=_0x436d41;io['to'](util[_0xa4cb('0x19')]('whatsapp:queue:%s',_0xfc2997['name']))['emit'](_0xa4cb('0x1a'),_0xfc2997);}};module['exports']=WhatsappQueue;
\ No newline at end of file
+var _0xae18=['socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','_rr','paused','length','online','loggedIn','whatsappPause','available','format','whatsapp:queue:%s','emit','exports','util','ioredis','../../../config/environment','redis','defaults','localhost'];(function(_0x16ccb7,_0x1103c0){var _0x467ae2=function(_0x107953){while(--_0x107953){_0x16ccb7['push'](_0x16ccb7['shift']());}};_0x467ae2(++_0x1103c0);}(_0xae18,0xf6));var _0x8ae1=function(_0x328a60,_0x513c88){_0x328a60=_0x328a60-0x0;var _0xa24025=_0xae18[_0x328a60];return _0xa24025;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x8ae1('0x0'));var Redis=require(_0x8ae1('0x1'));var config=require(_0x8ae1('0x2'));config[_0x8ae1('0x3')]=_[_0x8ae1('0x4')](config['redis'],{'host':_0x8ae1('0x5'),'port':0x18eb});var io=require(_0x8ae1('0x6'))(new Redis(config[_0x8ae1('0x3')]));function WhatsappQueue(_0x59ca85){this['id']=_0x59ca85['id']||0x0;this['name']=_0x59ca85['name']||'';this[_0x8ae1('0x7')]=_0x59ca85['timeout']||0xa;this[_0x8ae1('0x8')]=_0x59ca85['strategy']||_0x8ae1('0x9');this[_0x8ae1('0xa')]=_0x59ca85[_0x8ae1('0xa')];this[_0x8ae1('0xb')]={};this[_0x8ae1('0xc')]=0x0;this[_0x8ae1('0xd')]='';this[_0x8ae1('0xe')]();this[_0x8ae1('0xf')]();}WhatsappQueue[_0x8ae1('0x10')][_0x8ae1('0xe')]=function(){var _0x29c4ce=this[_0x8ae1('0xb')][_0x8ae1('0x11')];this[_0x8ae1('0xb')]=_['map'](this[_0x8ae1('0xa')],'id');this['mapAgentsId']['_rr']=_0x29c4ce;};WhatsappQueue[_0x8ae1('0x10')][_0x8ae1('0xf')]=function(){this['loggedIn']=0x0;this[_0x8ae1('0x12')]=0x0;for(var _0x30cede=0x0;_0x30cede<this[_0x8ae1('0xa')][_0x8ae1('0x13')];_0x30cede+=0x1){if(this['Agents'][_0x30cede][_0x8ae1('0x14')]){this[_0x8ae1('0x15')]+=0x1;}if(this['Agents'][_0x30cede][_0x8ae1('0x16')]){this[_0x8ae1('0x12')]+=0x1;}}this['available']=this['loggedIn']-this[_0x8ae1('0x12')];this[_0x8ae1('0x17')]=this['available']>=0x0?this[_0x8ae1('0x17')]:0x0;var _0x3168da={'id':this['id'],'available':this['available'],'loggedIn':this[_0x8ae1('0x15')],'name':this['name'],'paused':this[_0x8ae1('0x12')],'waiting':this[_0x8ae1('0xc')]};var _0x235a78=md5(JSON['stringify'](_0x3168da));if(this[_0x8ae1('0xd')]!==_0x235a78){this[_0x8ae1('0xd')]=_0x235a78;io['to'](util[_0x8ae1('0x18')](_0x8ae1('0x19'),_0x3168da['name']))[_0x8ae1('0x1a')]('whatsapp_queue:save',_0x3168da);}};module[_0x8ae1('0x1b')]=WhatsappQueue;
\ No newline at end of file