Built motion from commit 25580385.|2.6.2
[motion2.git] / server / services / routing / model / mailQueue.js
index b950fe6..78afde2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1c2e=['md5','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','_rr','updateRealtime','paused','length','online','loggedIn','mailPause','stringify','emit','exports'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x1c2e,0xb8));var _0xe1c2=function(_0x171161,_0x5bdae8){_0x171161=_0x171161-0x0;var _0xb2dec3=_0x1c2e[_0x171161];return _0xb2dec3;};'use strict';var _=require('lodash');var md5=require(_0xe1c2('0x0'));var util=require('util');var Redis=require('ioredis');var config=require('../../../config/environment');config[_0xe1c2('0x1')]=_['defaults'](config[_0xe1c2('0x1')],{'host':_0xe1c2('0x2'),'port':0x18eb});var io=require(_0xe1c2('0x3'))(new Redis(config[_0xe1c2('0x1')]));function MailQueue(_0x1d0f5d){this['id']=_0x1d0f5d['id']||0x0;this[_0xe1c2('0x4')]=_0x1d0f5d['name']||'';this[_0xe1c2('0x5')]=_0x1d0f5d[_0xe1c2('0x5')]||0xa;this[_0xe1c2('0x6')]=_0x1d0f5d['strategy']||_0xe1c2('0x7');this['Agents']=_0x1d0f5d[_0xe1c2('0x8')];this[_0xe1c2('0x9')]={};this[_0xe1c2('0xa')]=0x0;this[_0xe1c2('0x0')]='';this[_0xe1c2('0xb')]();this['updateRealtime']();}MailQueue[_0xe1c2('0xc')][_0xe1c2('0xb')]=function(){var _0x17f7a0=this['mapAgentsId'][_0xe1c2('0xd')];this['mapAgentsId']=_['map'](this['Agents'],'id');this[_0xe1c2('0x9')][_0xe1c2('0xd')]=_0x17f7a0;};MailQueue[_0xe1c2('0xc')][_0xe1c2('0xe')]=function(){this['loggedIn']=0x0;this[_0xe1c2('0xf')]=0x0;for(var _0x28b526=0x0;_0x28b526<this[_0xe1c2('0x8')][_0xe1c2('0x10')];_0x28b526+=0x1){if(this[_0xe1c2('0x8')][_0x28b526][_0xe1c2('0x11')]){this[_0xe1c2('0x12')]+=0x1;}if(this[_0xe1c2('0x8')][_0x28b526][_0xe1c2('0x13')]){this[_0xe1c2('0xf')]+=0x1;}}this['available']=this[_0xe1c2('0x12')]-this[_0xe1c2('0xf')];this['available']=this['available']>=0x0?this['available']:0x0;var _0x30216b={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0xe1c2('0xa')]};var _0x38a45c=md5(JSON[_0xe1c2('0x14')](_0x30216b));if(this[_0xe1c2('0x0')]!==_0x38a45c){this['md5']=_0x38a45c;io['to'](util['format']('mail:queue:%s',_0x30216b[_0xe1c2('0x4')]))[_0xe1c2('0x15')]('mail_queue:save',_0x30216b);}};module[_0xe1c2('0x16')]=MailQueue;
\ No newline at end of file
+var _0xadb8=['format','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','ioredis','redis','defaults','localhost','socket.io-emitter','name','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','online','mailPause','available','waiting','stringify'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0xadb8,0x155));var _0x8adb=function(_0x2e2f84,_0x24e46f){_0x2e2f84=_0x2e2f84-0x0;var _0x448191=_0xadb8[_0x2e2f84];return _0x448191;};'use strict';var _=require(_0x8adb('0x0'));var md5=require(_0x8adb('0x1'));var util=require('util');var Redis=require(_0x8adb('0x2'));var config=require('../../../config/environment');config[_0x8adb('0x3')]=_[_0x8adb('0x4')](config['redis'],{'host':_0x8adb('0x5'),'port':0x18eb});var io=require(_0x8adb('0x6'))(new Redis(config['redis']));function MailQueue(_0x731a93){this['id']=_0x731a93['id']||0x0;this['name']=_0x731a93[_0x8adb('0x7')]||'';this['timeout']=_0x731a93['timeout']||0xa;this['strategy']=_0x731a93['strategy']||_0x8adb('0x8');this[_0x8adb('0x9')]=_0x731a93[_0x8adb('0x9')];this[_0x8adb('0xa')]={};this['waiting']=0x0;this[_0x8adb('0x1')]='';this[_0x8adb('0xb')]();this[_0x8adb('0xc')]();}MailQueue[_0x8adb('0xd')]['updateRouting']=function(){var _0x2e96bd=this['mapAgentsId'][_0x8adb('0xe')];this[_0x8adb('0xa')]=_[_0x8adb('0xf')](this['Agents'],'id');this['mapAgentsId'][_0x8adb('0xe')]=_0x2e96bd;};MailQueue['prototype'][_0x8adb('0xc')]=function(){this[_0x8adb('0x10')]=0x0;this[_0x8adb('0x11')]=0x0;for(var _0x53789f=0x0;_0x53789f<this[_0x8adb('0x9')]['length'];_0x53789f+=0x1){if(this[_0x8adb('0x9')][_0x53789f][_0x8adb('0x12')]){this[_0x8adb('0x10')]+=0x1;}if(this['Agents'][_0x53789f][_0x8adb('0x13')]){this[_0x8adb('0x11')]+=0x1;}}this[_0x8adb('0x14')]=this[_0x8adb('0x10')]-this[_0x8adb('0x11')];this[_0x8adb('0x14')]=this[_0x8adb('0x14')]>=0x0?this[_0x8adb('0x14')]:0x0;var _0x2bb919={'id':this['id'],'available':this[_0x8adb('0x14')],'loggedIn':this[_0x8adb('0x10')],'name':this['name'],'paused':this[_0x8adb('0x11')],'waiting':this[_0x8adb('0x15')]};var _0x31f174=md5(JSON[_0x8adb('0x16')](_0x2bb919));if(this[_0x8adb('0x1')]!==_0x31f174){this['md5']=_0x31f174;io['to'](util[_0x8adb('0x17')](_0x8adb('0x18'),_0x2bb919[_0x8adb('0x7')]))[_0x8adb('0x19')](_0x8adb('0x1a'),_0x2bb919);}};module[_0x8adb('0x1b')]=MailQueue;
\ No newline at end of file