Built motion from commit b5413ace.|2.6.9
[motion2.git] / server / services / routing / model / mailQueue.js
index 2c4483f..04e947d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb278=['localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','map','prototype','loggedIn','paused','online','available','stringify','format','emit','mail_queue:save','exports','md5','util','../../../config/environment','redis'];(function(_0x449746,_0x16fda7){var _0x5be1de=function(_0x49d01b){while(--_0x49d01b){_0x449746['push'](_0x449746['shift']());}};_0x5be1de(++_0x16fda7);}(_0xb278,0x168));var _0x8b27=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xb278[_0x3b380d];return _0x54502b;};'use strict';var _=require('lodash');var md5=require(_0x8b27('0x0'));var util=require(_0x8b27('0x1'));var Redis=require('ioredis');var config=require(_0x8b27('0x2'));config['redis']=_['defaults'](config[_0x8b27('0x3')],{'host':_0x8b27('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8b27('0x3')]));function MailQueue(_0x5011fd){this['id']=_0x5011fd['id']||0x0;this[_0x8b27('0x5')]=_0x5011fd[_0x8b27('0x5')]||'';this[_0x8b27('0x6')]=_0x5011fd[_0x8b27('0x6')]||0xa;this[_0x8b27('0x7')]=_0x5011fd['strategy']||_0x8b27('0x8');this[_0x8b27('0x9')]=_0x5011fd[_0x8b27('0x9')];this[_0x8b27('0xa')]={};this[_0x8b27('0xb')]=0x0;this['md5']='';this[_0x8b27('0xc')]();this[_0x8b27('0xd')]();}MailQueue['prototype']['updateRouting']=function(){var _0x593dd6=this[_0x8b27('0xa')][_0x8b27('0xe')];this[_0x8b27('0xa')]=_[_0x8b27('0xf')](this['Agents'],'id');this[_0x8b27('0xa')][_0x8b27('0xe')]=_0x593dd6;};MailQueue[_0x8b27('0x10')][_0x8b27('0xd')]=function(){this[_0x8b27('0x11')]=0x0;this[_0x8b27('0x12')]=0x0;for(var _0x5217ea=0x0;_0x5217ea<this[_0x8b27('0x9')]['length'];_0x5217ea+=0x1){if(this[_0x8b27('0x9')][_0x5217ea][_0x8b27('0x13')]){this[_0x8b27('0x11')]+=0x1;}if(this[_0x8b27('0x9')][_0x5217ea]['mailPause']){this['paused']+=0x1;}}this[_0x8b27('0x14')]=this[_0x8b27('0x11')]-this[_0x8b27('0x12')];this['available']=this['available']>=0x0?this['available']:0x0;var _0x143b78={'id':this['id'],'available':this['available'],'loggedIn':this[_0x8b27('0x11')],'name':this[_0x8b27('0x5')],'paused':this[_0x8b27('0x12')],'waiting':this[_0x8b27('0xb')]};var _0x5f4958=md5(JSON[_0x8b27('0x15')](_0x143b78));if(this[_0x8b27('0x0')]!==_0x5f4958){this[_0x8b27('0x0')]=_0x5f4958;io['to'](util[_0x8b27('0x16')]('mail:queue:%s',_0x143b78[_0x8b27('0x5')]))[_0x8b27('0x17')](_0x8b27('0x18'),_0x143b78);}};module[_0x8b27('0x19')]=MailQueue;
\ No newline at end of file
+var _0x945e=['ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','loggedIn','paused','length','Agents','online','mailPause','available','stringify','format','mail:queue:%s','mail_queue:save','exports','lodash','md5','util'];(function(_0x6a0110,_0x570bd1){var _0x5d6f3c=function(_0x43ce79){while(--_0x43ce79){_0x6a0110['push'](_0x6a0110['shift']());}};_0x5d6f3c(++_0x570bd1);}(_0x945e,0x10b));var _0xe945=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x945e[_0x334841];return _0x5beb4b;};'use strict';var _=require(_0xe945('0x0'));var md5=require(_0xe945('0x1'));var util=require(_0xe945('0x2'));var Redis=require(_0xe945('0x3'));var config=require(_0xe945('0x4'));config['redis']=_['defaults'](config[_0xe945('0x5')],{'host':_0xe945('0x6'),'port':0x18eb});var io=require(_0xe945('0x7'))(new Redis(config['redis']));function MailQueue(_0x3f50e9){this['id']=_0x3f50e9['id']||0x0;this[_0xe945('0x8')]=_0x3f50e9[_0xe945('0x8')]||'';this[_0xe945('0x9')]=_0x3f50e9['timeout']||0xa;this[_0xe945('0xa')]=_0x3f50e9['strategy']||_0xe945('0xb');this['Agents']=_0x3f50e9['Agents'];this['mapAgentsId']={};this[_0xe945('0xc')]=0x0;this['md5']='';this[_0xe945('0xd')]();this[_0xe945('0xe')]();}MailQueue[_0xe945('0xf')]['updateRouting']=function(){var _0x155fbe=this[_0xe945('0x10')][_0xe945('0x11')];this[_0xe945('0x10')]=_['map'](this['Agents'],'id');this['mapAgentsId'][_0xe945('0x11')]=_0x155fbe;};MailQueue[_0xe945('0xf')][_0xe945('0xe')]=function(){this[_0xe945('0x12')]=0x0;this[_0xe945('0x13')]=0x0;for(var _0x511463=0x0;_0x511463<this['Agents'][_0xe945('0x14')];_0x511463+=0x1){if(this[_0xe945('0x15')][_0x511463][_0xe945('0x16')]){this[_0xe945('0x12')]+=0x1;}if(this['Agents'][_0x511463][_0xe945('0x17')]){this[_0xe945('0x13')]+=0x1;}}this[_0xe945('0x18')]=this['loggedIn']-this[_0xe945('0x13')];this[_0xe945('0x18')]=this[_0xe945('0x18')]>=0x0?this[_0xe945('0x18')]:0x0;var _0x5d3923={'id':this['id'],'available':this[_0xe945('0x18')],'loggedIn':this[_0xe945('0x12')],'name':this['name'],'paused':this[_0xe945('0x13')],'waiting':this[_0xe945('0xc')]};var _0x4f253a=md5(JSON[_0xe945('0x19')](_0x5d3923));if(this[_0xe945('0x1')]!==_0x4f253a){this[_0xe945('0x1')]=_0x4f253a;io['to'](util[_0xe945('0x1a')](_0xe945('0x1b'),_0x5d3923[_0xe945('0x8')]))['emit'](_0xe945('0x1c'),_0x5d3923);}};module[_0xe945('0x1d')]=MailQueue;
\ No newline at end of file