Built motion from commit 092f8824.|2.5.49
[motion2.git] / server / services / routing / model / mailQueue.js
index bf33fe7..da67ca6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x61e1=['format','mail:queue:%s','mail_queue:save','exports','lodash','util','defaults','redis','localhost','name','timeout','strategy','Agents','mapAgentsId','waiting','md5','updateRealtime','updateRouting','map','prototype','loggedIn','paused','mailPause','available'];(function(_0x333714,_0x3370ac){var _0x4c211e=function(_0x34219b){while(--_0x34219b){_0x333714['push'](_0x333714['shift']());}};_0x4c211e(++_0x3370ac);}(_0x61e1,0x7c));var _0x161e=function(_0x55ef60,_0x45f9f1){_0x55ef60=_0x55ef60-0x0;var _0xdef2f2=_0x61e1[_0x55ef60];return _0xdef2f2;};'use strict';var _=require(_0x161e('0x0'));var md5=require('md5');var util=require(_0x161e('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');config['redis']=_[_0x161e('0x2')](config[_0x161e('0x3')],{'host':_0x161e('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x161e('0x3')]));function MailQueue(_0x492af4){this['id']=_0x492af4['id']||0x0;this[_0x161e('0x5')]=_0x492af4[_0x161e('0x5')]||'';this[_0x161e('0x6')]=_0x492af4[_0x161e('0x6')]||0xa;this['strategy']=_0x492af4[_0x161e('0x7')]||'beepall';this[_0x161e('0x8')]=_0x492af4['Agents'];this[_0x161e('0x9')]={};this[_0x161e('0xa')]=0x0;this[_0x161e('0xb')]='';this['updateRouting']();this[_0x161e('0xc')]();}MailQueue['prototype'][_0x161e('0xd')]=function(){var _0x1afae8=this[_0x161e('0x9')]['_rr'];this[_0x161e('0x9')]=_[_0x161e('0xe')](this[_0x161e('0x8')],'id');this[_0x161e('0x9')]['_rr']=_0x1afae8;};MailQueue[_0x161e('0xf')][_0x161e('0xc')]=function(){this[_0x161e('0x10')]=0x0;this[_0x161e('0x11')]=0x0;for(var _0x1b0f4a=0x0;_0x1b0f4a<this[_0x161e('0x8')]['length'];_0x1b0f4a+=0x1){if(this[_0x161e('0x8')][_0x1b0f4a]['online']){this[_0x161e('0x10')]+=0x1;}if(this[_0x161e('0x8')][_0x1b0f4a][_0x161e('0x12')]){this[_0x161e('0x11')]+=0x1;}}this[_0x161e('0x13')]=this[_0x161e('0x10')]-this[_0x161e('0x11')];this[_0x161e('0x13')]=this[_0x161e('0x13')]>=0x0?this[_0x161e('0x13')]:0x0;var _0x422bbd={'id':this['id'],'available':this['available'],'loggedIn':this[_0x161e('0x10')],'name':this[_0x161e('0x5')],'paused':this[_0x161e('0x11')],'waiting':this['waiting']};var _0x35ba33=md5(JSON['stringify'](_0x422bbd));if(this[_0x161e('0xb')]!==_0x35ba33){this[_0x161e('0xb')]=_0x35ba33;io['to'](util[_0x161e('0x14')](_0x161e('0x15'),_0x422bbd[_0x161e('0x5')]))['emit'](_0x161e('0x16'),_0x422bbd);}};module[_0x161e('0x17')]=MailQueue;
\ No newline at end of file
+var _0x1f39=['mailPause','available','stringify','format','mail:queue:%s','mail_queue:save','exports','md5','util','../../../config/environment','redis','socket.io-emitter','name','timeout','strategy','beepall','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','_rr','map','Agents','loggedIn','paused','length','online'];(function(_0x3e1359,_0x77e06d){var _0x4b2728=function(_0x399899){while(--_0x399899){_0x3e1359['push'](_0x3e1359['shift']());}};_0x4b2728(++_0x77e06d);}(_0x1f39,0x173));var _0x91f3=function(_0x43dac3,_0x564736){_0x43dac3=_0x43dac3-0x0;var _0x2aac5c=_0x1f39[_0x43dac3];return _0x2aac5c;};'use strict';var _=require('lodash');var md5=require(_0x91f3('0x0'));var util=require(_0x91f3('0x1'));var Redis=require('ioredis');var config=require(_0x91f3('0x2'));config[_0x91f3('0x3')]=_['defaults'](config[_0x91f3('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x91f3('0x4'))(new Redis(config['redis']));function MailQueue(_0x834c11){this['id']=_0x834c11['id']||0x0;this[_0x91f3('0x5')]=_0x834c11['name']||'';this[_0x91f3('0x6')]=_0x834c11['timeout']||0xa;this[_0x91f3('0x7')]=_0x834c11[_0x91f3('0x7')]||_0x91f3('0x8');this['Agents']=_0x834c11['Agents'];this[_0x91f3('0x9')]={};this[_0x91f3('0xa')]=0x0;this[_0x91f3('0x0')]='';this['updateRouting']();this[_0x91f3('0xb')]();}MailQueue[_0x91f3('0xc')][_0x91f3('0xd')]=function(){var _0xe4274e=this['mapAgentsId'][_0x91f3('0xe')];this[_0x91f3('0x9')]=_[_0x91f3('0xf')](this[_0x91f3('0x10')],'id');this[_0x91f3('0x9')]['_rr']=_0xe4274e;};MailQueue['prototype']['updateRealtime']=function(){this[_0x91f3('0x11')]=0x0;this[_0x91f3('0x12')]=0x0;for(var _0x4e6bb9=0x0;_0x4e6bb9<this[_0x91f3('0x10')][_0x91f3('0x13')];_0x4e6bb9+=0x1){if(this[_0x91f3('0x10')][_0x4e6bb9][_0x91f3('0x14')]){this['loggedIn']+=0x1;}if(this[_0x91f3('0x10')][_0x4e6bb9][_0x91f3('0x15')]){this[_0x91f3('0x12')]+=0x1;}}this[_0x91f3('0x16')]=this[_0x91f3('0x11')]-this[_0x91f3('0x12')];this[_0x91f3('0x16')]=this[_0x91f3('0x16')]>=0x0?this[_0x91f3('0x16')]:0x0;var _0x2ed68f={'id':this['id'],'available':this[_0x91f3('0x16')],'loggedIn':this[_0x91f3('0x11')],'name':this[_0x91f3('0x5')],'paused':this['paused'],'waiting':this['waiting']};var _0x556ab9=md5(JSON[_0x91f3('0x17')](_0x2ed68f));if(this['md5']!==_0x556ab9){this[_0x91f3('0x0')]=_0x556ab9;io['to'](util[_0x91f3('0x18')](_0x91f3('0x19'),_0x2ed68f[_0x91f3('0x5')]))['emit'](_0x91f3('0x1a'),_0x2ed68f);}};module[_0x91f3('0x1b')]=MailQueue;
\ No newline at end of file