Built motion from commit 37e1ed56.|2.6.29
[motion2.git] / server / services / routing / model / whatsappQueue.js
index e987584..8167b45 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x764c=['redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','md5','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','available','waiting','format','whatsapp:queue:%s','emit','whatsapp_queue:save','lodash','util','ioredis','../../../config/environment'];(function(_0xb244c9,_0x116423){var _0x20d64a=function(_0x30b87e){while(--_0x30b87e){_0xb244c9['push'](_0xb244c9['shift']());}};_0x20d64a(++_0x116423);}(_0x764c,0xf8));var _0xc764=function(_0x3ddcde,_0x644e6c){_0x3ddcde=_0x3ddcde-0x0;var _0x422404=_0x764c[_0x3ddcde];return _0x422404;};'use strict';var _=require(_0xc764('0x0'));var md5=require('md5');var util=require(_0xc764('0x1'));var Redis=require(_0xc764('0x2'));var config=require(_0xc764('0x3'));config[_0xc764('0x4')]=_[_0xc764('0x5')](config[_0xc764('0x4')],{'host':_0xc764('0x6'),'port':0x18eb});var io=require(_0xc764('0x7'))(new Redis(config[_0xc764('0x4')]));function WhatsappQueue(_0x5e6ad7){this['id']=_0x5e6ad7['id']||0x0;this[_0xc764('0x8')]=_0x5e6ad7[_0xc764('0x8')]||'';this[_0xc764('0x9')]=_0x5e6ad7[_0xc764('0x9')]||0xa;this[_0xc764('0xa')]=_0x5e6ad7[_0xc764('0xa')]||_0xc764('0xb');this[_0xc764('0xc')]=_0x5e6ad7[_0xc764('0xc')];this[_0xc764('0xd')]={};this['waiting']=0x0;this[_0xc764('0xe')]='';this[_0xc764('0xf')]();this[_0xc764('0x10')]();}WhatsappQueue[_0xc764('0x11')][_0xc764('0xf')]=function(){var _0x43bf14=this[_0xc764('0xd')][_0xc764('0x12')];this['mapAgentsId']=_[_0xc764('0x13')](this[_0xc764('0xc')],'id');this['mapAgentsId']['_rr']=_0x43bf14;};WhatsappQueue[_0xc764('0x11')]['updateRealtime']=function(){this[_0xc764('0x14')]=0x0;this[_0xc764('0x15')]=0x0;for(var _0x3f1703=0x0;_0x3f1703<this[_0xc764('0xc')]['length'];_0x3f1703+=0x1){if(this[_0xc764('0xc')][_0x3f1703]['online']){this['loggedIn']+=0x1;}if(this[_0xc764('0xc')][_0x3f1703]['whatsappPause']){this[_0xc764('0x15')]+=0x1;}}this[_0xc764('0x16')]=this[_0xc764('0x14')]-this[_0xc764('0x15')];this[_0xc764('0x16')]=this[_0xc764('0x16')]>=0x0?this[_0xc764('0x16')]:0x0;var _0x116639={'id':this['id'],'available':this[_0xc764('0x16')],'loggedIn':this[_0xc764('0x14')],'name':this[_0xc764('0x8')],'paused':this[_0xc764('0x15')],'waiting':this[_0xc764('0x17')]};var _0x51c11b=md5(JSON['stringify'](_0x116639));if(this[_0xc764('0xe')]!==_0x51c11b){this[_0xc764('0xe')]=_0x51c11b;io['to'](util[_0xc764('0x18')](_0xc764('0x19'),_0x116639[_0xc764('0x8')]))[_0xc764('0x1a')](_0xc764('0x1b'),_0x116639);}};module['exports']=WhatsappQueue;
\ No newline at end of file
+var _0xbc05=['socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','length','online','whatsappPause','available','paused','stringify','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','md5','util','ioredis','../../../config/environment','redis'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xbc05,0xdb));var _0x5bc0=function(_0x43266d,_0x3c0a39){_0x43266d=_0x43266d-0x0;var _0x2c2bab=_0xbc05[_0x43266d];return _0x2c2bab;};'use strict';var _=require('lodash');var md5=require(_0x5bc0('0x0'));var util=require(_0x5bc0('0x1'));var Redis=require(_0x5bc0('0x2'));var config=require(_0x5bc0('0x3'));config[_0x5bc0('0x4')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x5bc0('0x5'))(new Redis(config[_0x5bc0('0x4')]));function WhatsappQueue(_0x14a425){this['id']=_0x14a425['id']||0x0;this[_0x5bc0('0x6')]=_0x14a425['name']||'';this[_0x5bc0('0x7')]=_0x14a425['timeout']||0xa;this['strategy']=_0x14a425[_0x5bc0('0x8')]||_0x5bc0('0x9');this[_0x5bc0('0xa')]=_0x14a425['Agents'];this[_0x5bc0('0xb')]={};this['waiting']=0x0;this[_0x5bc0('0x0')]='';this[_0x5bc0('0xc')]();this[_0x5bc0('0xd')]();}WhatsappQueue[_0x5bc0('0xe')]['updateRouting']=function(){var _0x3e0700=this['mapAgentsId'][_0x5bc0('0xf')];this[_0x5bc0('0xb')]=_[_0x5bc0('0x10')](this['Agents'],'id');this['mapAgentsId'][_0x5bc0('0xf')]=_0x3e0700;};WhatsappQueue[_0x5bc0('0xe')][_0x5bc0('0xd')]=function(){this[_0x5bc0('0x11')]=0x0;this['paused']=0x0;for(var _0x3bfc37=0x0;_0x3bfc37<this[_0x5bc0('0xa')][_0x5bc0('0x12')];_0x3bfc37+=0x1){if(this[_0x5bc0('0xa')][_0x3bfc37][_0x5bc0('0x13')]){this[_0x5bc0('0x11')]+=0x1;}if(this['Agents'][_0x3bfc37][_0x5bc0('0x14')]){this['paused']+=0x1;}}this[_0x5bc0('0x15')]=this['loggedIn']-this['paused'];this[_0x5bc0('0x15')]=this[_0x5bc0('0x15')]>=0x0?this['available']:0x0;var _0x23138c={'id':this['id'],'available':this[_0x5bc0('0x15')],'loggedIn':this[_0x5bc0('0x11')],'name':this[_0x5bc0('0x6')],'paused':this[_0x5bc0('0x16')],'waiting':this['waiting']};var _0x13b52b=md5(JSON[_0x5bc0('0x17')](_0x23138c));if(this['md5']!==_0x13b52b){this['md5']=_0x13b52b;io['to'](util['format'](_0x5bc0('0x18'),_0x23138c['name']))[_0x5bc0('0x19')](_0x5bc0('0x1a'),_0x23138c);}};module[_0x5bc0('0x1b')]=WhatsappQueue;
\ No newline at end of file