Built motion from commit 53172ac8.|2.6.30
[motion2.git] / server / services / routing / model / chatQueue.js
index e1a6e24..0d55071 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9759=['updateRealtime','prototype','mapAgentsId','_rr','map','Agents','loggedIn','paused','online','available','stringify','format','chat:queue:%s','emit','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','waiting','updateRouting'];(function(_0x2ab365,_0xa3812e){var _0x49fef3=function(_0x29b883){while(--_0x29b883){_0x2ab365['push'](_0x2ab365['shift']());}};_0x49fef3(++_0xa3812e);}(_0x9759,0x15f));var _0x9975=function(_0x124e0c,_0x1cab8b){_0x124e0c=_0x124e0c-0x0;var _0x15fc88=_0x9759[_0x124e0c];return _0x15fc88;};'use strict';var _=require(_0x9975('0x0'));var md5=require(_0x9975('0x1'));var util=require(_0x9975('0x2'));var Redis=require(_0x9975('0x3'));var config=require(_0x9975('0x4'));config[_0x9975('0x5')]=_[_0x9975('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x9975('0x7'))(new Redis(config['redis']));function ChatQueue(_0x315f7b){this['id']=_0x315f7b['id']||0x0;this[_0x9975('0x8')]=_0x315f7b['name']||'';this[_0x9975('0x9')]=_0x315f7b['timeout']||0xa;this[_0x9975('0xa')]=_0x315f7b[_0x9975('0xa')]||'beepall';this['Agents']=_0x315f7b['Agents'];this['mapAgentsId']={};this[_0x9975('0xb')]=0x0;this[_0x9975('0x1')]='';this[_0x9975('0xc')]();this[_0x9975('0xd')]();}ChatQueue[_0x9975('0xe')]['updateRouting']=function(){var _0x194985=this[_0x9975('0xf')][_0x9975('0x10')];this[_0x9975('0xf')]=_[_0x9975('0x11')](this[_0x9975('0x12')],'id');this[_0x9975('0xf')][_0x9975('0x10')]=_0x194985;};ChatQueue['prototype'][_0x9975('0xd')]=function(){this[_0x9975('0x13')]=0x0;this[_0x9975('0x14')]=0x0;for(var _0x3a17c3=0x0;_0x3a17c3<this[_0x9975('0x12')]['length'];_0x3a17c3+=0x1){if(this['Agents'][_0x3a17c3][_0x9975('0x15')]){this[_0x9975('0x13')]+=0x1;}if(this[_0x9975('0x12')][_0x3a17c3]['chatPause']){this[_0x9975('0x14')]+=0x1;}}this['available']=this['loggedIn']-this[_0x9975('0x14')];this['available']=this[_0x9975('0x16')]>=0x0?this[_0x9975('0x16')]:0x0;var _0x3afe08={'id':this['id'],'available':this[_0x9975('0x16')],'loggedIn':this['loggedIn'],'name':this[_0x9975('0x8')],'paused':this['paused'],'waiting':this[_0x9975('0xb')]};var _0x5be3c8=md5(JSON[_0x9975('0x17')](_0x3afe08));if(this[_0x9975('0x1')]!==_0x5be3c8){this[_0x9975('0x1')]=_0x5be3c8;io['to'](util[_0x9975('0x18')](_0x9975('0x19'),_0x3afe08[_0x9975('0x8')]))[_0x9975('0x1a')]('chat_queue:save',_0x3afe08);}};module[_0x9975('0x1b')]=ChatQueue;
\ No newline at end of file
+var _0xc35b=['paused','available','name','stringify','format','chat:queue:%s','emit','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','map','prototype','loggedIn','online','chatPause'];(function(_0x42021b,_0x461234){var _0xbc97cb=function(_0x48cd54){while(--_0x48cd54){_0x42021b['push'](_0x42021b['shift']());}};_0xbc97cb(++_0x461234);}(_0xc35b,0x1ab));var _0xbc35=function(_0x58dc25,_0x49b9d5){_0x58dc25=_0x58dc25-0x0;var _0x21b0a7=_0xc35b[_0x58dc25];return _0x21b0a7;};'use strict';var _=require('lodash');var md5=require(_0xbc35('0x0'));var util=require(_0xbc35('0x1'));var Redis=require(_0xbc35('0x2'));var config=require(_0xbc35('0x3'));config[_0xbc35('0x4')]=_[_0xbc35('0x5')](config['redis'],{'host':_0xbc35('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function ChatQueue(_0x13cad1){this['id']=_0x13cad1['id']||0x0;this['name']=_0x13cad1['name']||'';this[_0xbc35('0x7')]=_0x13cad1[_0xbc35('0x7')]||0xa;this[_0xbc35('0x8')]=_0x13cad1[_0xbc35('0x8')]||_0xbc35('0x9');this[_0xbc35('0xa')]=_0x13cad1[_0xbc35('0xa')];this[_0xbc35('0xb')]={};this[_0xbc35('0xc')]=0x0;this[_0xbc35('0x0')]='';this[_0xbc35('0xd')]();this[_0xbc35('0xe')]();}ChatQueue['prototype'][_0xbc35('0xd')]=function(){var _0x1f32cc=this[_0xbc35('0xb')][_0xbc35('0xf')];this['mapAgentsId']=_[_0xbc35('0x10')](this[_0xbc35('0xa')],'id');this[_0xbc35('0xb')][_0xbc35('0xf')]=_0x1f32cc;};ChatQueue[_0xbc35('0x11')][_0xbc35('0xe')]=function(){this[_0xbc35('0x12')]=0x0;this['paused']=0x0;for(var _0x28273f=0x0;_0x28273f<this[_0xbc35('0xa')]['length'];_0x28273f+=0x1){if(this[_0xbc35('0xa')][_0x28273f][_0xbc35('0x13')]){this[_0xbc35('0x12')]+=0x1;}if(this['Agents'][_0x28273f][_0xbc35('0x14')]){this[_0xbc35('0x15')]+=0x1;}}this['available']=this[_0xbc35('0x12')]-this['paused'];this[_0xbc35('0x16')]=this[_0xbc35('0x16')]>=0x0?this[_0xbc35('0x16')]:0x0;var _0x26197a={'id':this['id'],'available':this[_0xbc35('0x16')],'loggedIn':this['loggedIn'],'name':this[_0xbc35('0x17')],'paused':this[_0xbc35('0x15')],'waiting':this[_0xbc35('0xc')]};var _0x511934=md5(JSON[_0xbc35('0x18')](_0x26197a));if(this[_0xbc35('0x0')]!==_0x511934){this[_0xbc35('0x0')]=_0x511934;io['to'](util[_0xbc35('0x19')](_0xbc35('0x1a'),_0x26197a[_0xbc35('0x17')]))[_0xbc35('0x1b')]('chat_queue:save',_0x26197a);}};module['exports']=ChatQueue;
\ No newline at end of file