Built motion from commit 06a208af.|2.6.26
[motion2.git] / server / services / routing / model / whatsappQueue.js
index ae08cbc..5f8aef1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xdf86=['emit','whatsapp_queue:save','lodash','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','_rr','loggedIn','paused','online','whatsappPause','available','format'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xdf86,0x161));var _0x6df8=function(_0x2e04ef,_0x31a596){_0x2e04ef=_0x2e04ef-0x0;var _0x5722b0=_0xdf86[_0x2e04ef];return _0x5722b0;};'use strict';var _=require(_0x6df8('0x0'));var md5=require(_0x6df8('0x1'));var util=require('util');var Redis=require(_0x6df8('0x2'));var config=require(_0x6df8('0x3'));config[_0x6df8('0x4')]=_[_0x6df8('0x5')](config[_0x6df8('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x6df8('0x6'))(new Redis(config[_0x6df8('0x4')]));function WhatsappQueue(_0x238912){this['id']=_0x238912['id']||0x0;this['name']=_0x238912[_0x6df8('0x7')]||'';this[_0x6df8('0x8')]=_0x238912['timeout']||0xa;this[_0x6df8('0x9')]=_0x238912['strategy']||_0x6df8('0xa');this[_0x6df8('0xb')]=_0x238912['Agents'];this[_0x6df8('0xc')]={};this[_0x6df8('0xd')]=0x0;this[_0x6df8('0x1')]='';this[_0x6df8('0xe')]();this[_0x6df8('0xf')]();}WhatsappQueue[_0x6df8('0x10')][_0x6df8('0xe')]=function(){var _0x3c24c0=this[_0x6df8('0xc')]['_rr'];this[_0x6df8('0xc')]=_[_0x6df8('0x11')](this[_0x6df8('0xb')],'id');this[_0x6df8('0xc')][_0x6df8('0x12')]=_0x3c24c0;};WhatsappQueue[_0x6df8('0x10')]['updateRealtime']=function(){this[_0x6df8('0x13')]=0x0;this[_0x6df8('0x14')]=0x0;for(var _0xa98cd1=0x0;_0xa98cd1<this['Agents']['length'];_0xa98cd1+=0x1){if(this[_0x6df8('0xb')][_0xa98cd1][_0x6df8('0x15')]){this['loggedIn']+=0x1;}if(this[_0x6df8('0xb')][_0xa98cd1][_0x6df8('0x16')]){this['paused']+=0x1;}}this[_0x6df8('0x17')]=this[_0x6df8('0x13')]-this[_0x6df8('0x14')];this[_0x6df8('0x17')]=this[_0x6df8('0x17')]>=0x0?this[_0x6df8('0x17')]:0x0;var _0x3f00fe={'id':this['id'],'available':this[_0x6df8('0x17')],'loggedIn':this['loggedIn'],'name':this[_0x6df8('0x7')],'paused':this[_0x6df8('0x14')],'waiting':this[_0x6df8('0xd')]};var _0x226b9f=md5(JSON['stringify'](_0x3f00fe));if(this[_0x6df8('0x1')]!==_0x226b9f){this[_0x6df8('0x1')]=_0x226b9f;io['to'](util[_0x6df8('0x18')]('whatsapp:queue:%s',_0x3f00fe[_0x6df8('0x7')]))[_0x6df8('0x19')](_0x6df8('0x1a'),_0x3f00fe);}};module['exports']=WhatsappQueue;
\ No newline at end of file
+var _0xc2db=['available','waiting','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','md5','util','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRealtime','prototype','updateRouting','map','_rr','loggedIn','paused','length','online','whatsappPause'];(function(_0x561e8d,_0x4321af){var _0x31738f=function(_0xfaa5a6){while(--_0xfaa5a6){_0x561e8d['push'](_0x561e8d['shift']());}};_0x31738f(++_0x4321af);}(_0xc2db,0xe1));var _0xbc2d=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xc2db[_0x465028];return _0xb783d4;};'use strict';var _=require(_0xbc2d('0x0'));var md5=require(_0xbc2d('0x1'));var util=require(_0xbc2d('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0xbc2d('0x3')]=_[_0xbc2d('0x4')](config[_0xbc2d('0x3')],{'host':_0xbc2d('0x5'),'port':0x18eb});var io=require(_0xbc2d('0x6'))(new Redis(config['redis']));function WhatsappQueue(_0x34c97f){this['id']=_0x34c97f['id']||0x0;this[_0xbc2d('0x7')]=_0x34c97f[_0xbc2d('0x7')]||'';this[_0xbc2d('0x8')]=_0x34c97f[_0xbc2d('0x8')]||0xa;this['strategy']=_0x34c97f[_0xbc2d('0x9')]||_0xbc2d('0xa');this[_0xbc2d('0xb')]=_0x34c97f[_0xbc2d('0xb')];this[_0xbc2d('0xc')]={};this['waiting']=0x0;this['md5']='';this['updateRouting']();this[_0xbc2d('0xd')]();}WhatsappQueue[_0xbc2d('0xe')][_0xbc2d('0xf')]=function(){var _0x5c0c00=this[_0xbc2d('0xc')]['_rr'];this[_0xbc2d('0xc')]=_[_0xbc2d('0x10')](this[_0xbc2d('0xb')],'id');this['mapAgentsId'][_0xbc2d('0x11')]=_0x5c0c00;};WhatsappQueue[_0xbc2d('0xe')][_0xbc2d('0xd')]=function(){this[_0xbc2d('0x12')]=0x0;this[_0xbc2d('0x13')]=0x0;for(var _0xa1920b=0x0;_0xa1920b<this[_0xbc2d('0xb')][_0xbc2d('0x14')];_0xa1920b+=0x1){if(this[_0xbc2d('0xb')][_0xa1920b][_0xbc2d('0x15')]){this['loggedIn']+=0x1;}if(this[_0xbc2d('0xb')][_0xa1920b][_0xbc2d('0x16')]){this[_0xbc2d('0x13')]+=0x1;}}this[_0xbc2d('0x17')]=this[_0xbc2d('0x12')]-this[_0xbc2d('0x13')];this['available']=this['available']>=0x0?this[_0xbc2d('0x17')]:0x0;var _0x260852={'id':this['id'],'available':this[_0xbc2d('0x17')],'loggedIn':this[_0xbc2d('0x12')],'name':this[_0xbc2d('0x7')],'paused':this['paused'],'waiting':this[_0xbc2d('0x18')]};var _0x528be7=md5(JSON[_0xbc2d('0x19')](_0x260852));if(this[_0xbc2d('0x1')]!==_0x528be7){this[_0xbc2d('0x1')]=_0x528be7;io['to'](util[_0xbc2d('0x1a')](_0xbc2d('0x1b'),_0x260852[_0xbc2d('0x7')]))[_0xbc2d('0x1c')](_0xbc2d('0x1d'),_0x260852);}};module[_0xbc2d('0x1e')]=WhatsappQueue;
\ No newline at end of file