Built motion from commit c116dc8b.|2.6.30
[motion2.git] / server / services / routing / model / mailQueue.js
index 900064c..a46a2f9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x94f1=['timeout','strategy','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','_rr','Agents','loggedIn','paused','online','mailPause','available','format','emit','exports','lodash','md5','ioredis','redis','localhost','name'];(function(_0x5f5a65,_0x3fe565){var _0x2a8b2c=function(_0x4c4f11){while(--_0x4c4f11){_0x5f5a65['push'](_0x5f5a65['shift']());}};_0x2a8b2c(++_0x3fe565);}(_0x94f1,0x181));var _0x194f=function(_0xbf3b56,_0x900d6f){_0xbf3b56=_0xbf3b56-0x0;var _0xe5b67c=_0x94f1[_0xbf3b56];return _0xe5b67c;};'use strict';var _=require(_0x194f('0x0'));var md5=require(_0x194f('0x1'));var util=require('util');var Redis=require(_0x194f('0x2'));var config=require('../../../config/environment');config['redis']=_['defaults'](config[_0x194f('0x3')],{'host':_0x194f('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function MailQueue(_0x32d6e4){this['id']=_0x32d6e4['id']||0x0;this[_0x194f('0x5')]=_0x32d6e4[_0x194f('0x5')]||'';this[_0x194f('0x6')]=_0x32d6e4[_0x194f('0x6')]||0xa;this[_0x194f('0x7')]=_0x32d6e4[_0x194f('0x7')]||'beepall';this['Agents']=_0x32d6e4['Agents'];this[_0x194f('0x8')]={};this[_0x194f('0x9')]=0x0;this[_0x194f('0x1')]='';this['updateRouting']();this[_0x194f('0xa')]();}MailQueue[_0x194f('0xb')][_0x194f('0xc')]=function(){var _0x1c0816=this[_0x194f('0x8')][_0x194f('0xd')];this[_0x194f('0x8')]=_['map'](this[_0x194f('0xe')],'id');this[_0x194f('0x8')]['_rr']=_0x1c0816;};MailQueue['prototype']['updateRealtime']=function(){this[_0x194f('0xf')]=0x0;this[_0x194f('0x10')]=0x0;for(var _0x461b55=0x0;_0x461b55<this['Agents']['length'];_0x461b55+=0x1){if(this[_0x194f('0xe')][_0x461b55][_0x194f('0x11')]){this['loggedIn']+=0x1;}if(this[_0x194f('0xe')][_0x461b55][_0x194f('0x12')]){this[_0x194f('0x10')]+=0x1;}}this['available']=this['loggedIn']-this[_0x194f('0x10')];this[_0x194f('0x13')]=this['available']>=0x0?this['available']:0x0;var _0x116dd9={'id':this['id'],'available':this[_0x194f('0x13')],'loggedIn':this[_0x194f('0xf')],'name':this[_0x194f('0x5')],'paused':this['paused'],'waiting':this[_0x194f('0x9')]};var _0x3edcbb=md5(JSON['stringify'](_0x116dd9));if(this['md5']!==_0x3edcbb){this['md5']=_0x3edcbb;io['to'](util[_0x194f('0x14')]('mail:queue:%s',_0x116dd9['name']))[_0x194f('0x15')]('mail_queue:save',_0x116dd9);}};module[_0x194f('0x16')]=MailQueue;
\ No newline at end of file
+var _0x77ba=['localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRealtime','prototype','updateRouting','_rr','map','loggedIn','length','online','mailPause','available','paused','waiting','format','emit','mail_queue:save','exports','lodash','md5','../../../config/environment','redis','defaults'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x77ba,0x100));var _0xa77b=function(_0x213518,_0x51e022){_0x213518=_0x213518-0x0;var _0x1baf75=_0x77ba[_0x213518];return _0x1baf75;};'use strict';var _=require(_0xa77b('0x0'));var md5=require(_0xa77b('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0xa77b('0x2'));config[_0xa77b('0x3')]=_[_0xa77b('0x4')](config[_0xa77b('0x3')],{'host':_0xa77b('0x5'),'port':0x18eb});var io=require(_0xa77b('0x6'))(new Redis(config[_0xa77b('0x3')]));function MailQueue(_0x4fa141){this['id']=_0x4fa141['id']||0x0;this[_0xa77b('0x7')]=_0x4fa141[_0xa77b('0x7')]||'';this[_0xa77b('0x8')]=_0x4fa141[_0xa77b('0x8')]||0xa;this[_0xa77b('0x9')]=_0x4fa141[_0xa77b('0x9')]||_0xa77b('0xa');this[_0xa77b('0xb')]=_0x4fa141['Agents'];this[_0xa77b('0xc')]={};this['waiting']=0x0;this[_0xa77b('0x1')]='';this['updateRouting']();this[_0xa77b('0xd')]();}MailQueue[_0xa77b('0xe')][_0xa77b('0xf')]=function(){var _0x4c64cd=this['mapAgentsId'][_0xa77b('0x10')];this[_0xa77b('0xc')]=_[_0xa77b('0x11')](this['Agents'],'id');this[_0xa77b('0xc')][_0xa77b('0x10')]=_0x4c64cd;};MailQueue[_0xa77b('0xe')][_0xa77b('0xd')]=function(){this[_0xa77b('0x12')]=0x0;this['paused']=0x0;for(var _0xd4a2b7=0x0;_0xd4a2b7<this['Agents'][_0xa77b('0x13')];_0xd4a2b7+=0x1){if(this[_0xa77b('0xb')][_0xd4a2b7][_0xa77b('0x14')]){this[_0xa77b('0x12')]+=0x1;}if(this[_0xa77b('0xb')][_0xd4a2b7][_0xa77b('0x15')]){this['paused']+=0x1;}}this[_0xa77b('0x16')]=this[_0xa77b('0x12')]-this['paused'];this['available']=this[_0xa77b('0x16')]>=0x0?this[_0xa77b('0x16')]:0x0;var _0x1c6395={'id':this['id'],'available':this[_0xa77b('0x16')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0xa77b('0x17')],'waiting':this[_0xa77b('0x18')]};var _0x4255b2=md5(JSON['stringify'](_0x1c6395));if(this['md5']!==_0x4255b2){this[_0xa77b('0x1')]=_0x4255b2;io['to'](util[_0xa77b('0x19')]('mail:queue:%s',_0x1c6395[_0xa77b('0x7')]))[_0xa77b('0x1a')](_0xa77b('0x1b'),_0x1c6395);}};module[_0xa77b('0x1c')]=MailQueue;
\ No newline at end of file