Built motion from commit efa66e19.|2.6.22
[motion2.git] / server / services / routing / model / mailQueue.js
index 0bf6243..60620c2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x156f=['loggedIn','paused','length','online','mailPause','available','name','waiting','stringify','format','mail_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','timeout','strategy','Agents','mapAgentsId','updateRouting','updateRealtime','_rr'];(function(_0x2582af,_0x3409f7){var _0x38c9c6=function(_0x2695e4){while(--_0x2695e4){_0x2582af['push'](_0x2582af['shift']());}};_0x38c9c6(++_0x3409f7);}(_0x156f,0xf6));var _0xf156=function(_0x4d4e50,_0x394d0e){_0x4d4e50=_0x4d4e50-0x0;var _0x4db4a5=_0x156f[_0x4d4e50];return _0x4db4a5;};'use strict';var _=require(_0xf156('0x0'));var md5=require(_0xf156('0x1'));var util=require(_0xf156('0x2'));var Redis=require(_0xf156('0x3'));var config=require(_0xf156('0x4'));config[_0xf156('0x5')]=_[_0xf156('0x6')](config[_0xf156('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf156('0x5')]));function MailQueue(_0x7a14ba){this['id']=_0x7a14ba['id']||0x0;this['name']=_0x7a14ba['name']||'';this[_0xf156('0x7')]=_0x7a14ba[_0xf156('0x7')]||0xa;this[_0xf156('0x8')]=_0x7a14ba['strategy']||'beepall';this['Agents']=_0x7a14ba[_0xf156('0x9')];this[_0xf156('0xa')]={};this['waiting']=0x0;this[_0xf156('0x1')]='';this[_0xf156('0xb')]();this[_0xf156('0xc')]();}MailQueue['prototype']['updateRouting']=function(){var _0x3e54d5=this[_0xf156('0xa')][_0xf156('0xd')];this[_0xf156('0xa')]=_['map'](this[_0xf156('0x9')],'id');this[_0xf156('0xa')][_0xf156('0xd')]=_0x3e54d5;};MailQueue['prototype']['updateRealtime']=function(){this[_0xf156('0xe')]=0x0;this[_0xf156('0xf')]=0x0;for(var _0x16158b=0x0;_0x16158b<this[_0xf156('0x9')][_0xf156('0x10')];_0x16158b+=0x1){if(this[_0xf156('0x9')][_0x16158b][_0xf156('0x11')]){this['loggedIn']+=0x1;}if(this['Agents'][_0x16158b][_0xf156('0x12')]){this[_0xf156('0xf')]+=0x1;}}this[_0xf156('0x13')]=this[_0xf156('0xe')]-this[_0xf156('0xf')];this[_0xf156('0x13')]=this['available']>=0x0?this[_0xf156('0x13')]:0x0;var _0x513984={'id':this['id'],'available':this['available'],'loggedIn':this[_0xf156('0xe')],'name':this[_0xf156('0x14')],'paused':this[_0xf156('0xf')],'waiting':this[_0xf156('0x15')]};var _0x533757=md5(JSON[_0xf156('0x16')](_0x513984));if(this['md5']!==_0x533757){this['md5']=_0x533757;io['to'](util[_0xf156('0x17')]('mail:queue:%s',_0x513984[_0xf156('0x14')]))['emit'](_0xf156('0x18'),_0x513984);}};module[_0xf156('0x19')]=MailQueue;
\ No newline at end of file
+var _0x1cbb=['md5','format','mail:queue:%s','emit','mail_queue:save','exports','util','ioredis','../../../config/environment','localhost','redis','timeout','strategy','beepall','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','Agents','loggedIn','paused','length','online','mailPause','available','name','stringify'];(function(_0x31f5e1,_0x5d8b29){var _0x521cfd=function(_0x2c2b1d){while(--_0x2c2b1d){_0x31f5e1['push'](_0x31f5e1['shift']());}};_0x521cfd(++_0x5d8b29);}(_0x1cbb,0x1f3));var _0xb1cb=function(_0x11f012,_0xd13229){_0x11f012=_0x11f012-0x0;var _0x4602f0=_0x1cbb[_0x11f012];return _0x4602f0;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0xb1cb('0x0'));var Redis=require(_0xb1cb('0x1'));var config=require(_0xb1cb('0x2'));config['redis']=_['defaults'](config['redis'],{'host':_0xb1cb('0x3'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb1cb('0x4')]));function MailQueue(_0x3e75c7){this['id']=_0x3e75c7['id']||0x0;this['name']=_0x3e75c7['name']||'';this['timeout']=_0x3e75c7[_0xb1cb('0x5')]||0xa;this['strategy']=_0x3e75c7[_0xb1cb('0x6')]||_0xb1cb('0x7');this['Agents']=_0x3e75c7['Agents'];this[_0xb1cb('0x8')]={};this[_0xb1cb('0x9')]=0x0;this['md5']='';this[_0xb1cb('0xa')]();this[_0xb1cb('0xb')]();}MailQueue[_0xb1cb('0xc')][_0xb1cb('0xa')]=function(){var _0x1f9ac9=this[_0xb1cb('0x8')]['_rr'];this['mapAgentsId']=_[_0xb1cb('0xd')](this[_0xb1cb('0xe')],'id');this[_0xb1cb('0x8')]['_rr']=_0x1f9ac9;};MailQueue[_0xb1cb('0xc')]['updateRealtime']=function(){this[_0xb1cb('0xf')]=0x0;this[_0xb1cb('0x10')]=0x0;for(var _0x58c14f=0x0;_0x58c14f<this[_0xb1cb('0xe')][_0xb1cb('0x11')];_0x58c14f+=0x1){if(this[_0xb1cb('0xe')][_0x58c14f][_0xb1cb('0x12')]){this[_0xb1cb('0xf')]+=0x1;}if(this[_0xb1cb('0xe')][_0x58c14f][_0xb1cb('0x13')]){this[_0xb1cb('0x10')]+=0x1;}}this[_0xb1cb('0x14')]=this[_0xb1cb('0xf')]-this[_0xb1cb('0x10')];this[_0xb1cb('0x14')]=this[_0xb1cb('0x14')]>=0x0?this[_0xb1cb('0x14')]:0x0;var _0x209801={'id':this['id'],'available':this[_0xb1cb('0x14')],'loggedIn':this[_0xb1cb('0xf')],'name':this[_0xb1cb('0x15')],'paused':this[_0xb1cb('0x10')],'waiting':this['waiting']};var _0x468029=md5(JSON[_0xb1cb('0x16')](_0x209801));if(this['md5']!==_0x468029){this[_0xb1cb('0x17')]=_0x468029;io['to'](util[_0xb1cb('0x18')](_0xb1cb('0x19'),_0x209801[_0xb1cb('0x15')]))[_0xb1cb('0x1a')](_0xb1cb('0x1b'),_0x209801);}};module[_0xb1cb('0x1c')]=MailQueue;
\ No newline at end of file