Built motion from commit 85f716e9.|2.6.8
[motion2.git] / server / services / routing / model / chatQueue.js
index 184ec62..c6c5dec 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x22f8=['available','stringify','format','chat:queue:%s','emit','exports','lodash','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','beepall','Agents','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','length','online','loggedIn','chatPause','paused'];(function(_0x44549d,_0x15fabc){var _0x2386c3=function(_0x507f5f){while(--_0x507f5f){_0x44549d['push'](_0x44549d['shift']());}};_0x2386c3(++_0x15fabc);}(_0x22f8,0x180));var _0x822f=function(_0x4e713e,_0x1ac682){_0x4e713e=_0x4e713e-0x0;var _0x296ac0=_0x22f8[_0x4e713e];return _0x296ac0;};'use strict';var _=require(_0x822f('0x0'));var md5=require(_0x822f('0x1'));var util=require('util');var Redis=require(_0x822f('0x2'));var config=require(_0x822f('0x3'));config[_0x822f('0x4')]=_['defaults'](config[_0x822f('0x4')],{'host':_0x822f('0x5'),'port':0x18eb});var io=require(_0x822f('0x6'))(new Redis(config[_0x822f('0x4')]));function ChatQueue(_0x772254){this['id']=_0x772254['id']||0x0;this[_0x822f('0x7')]=_0x772254[_0x822f('0x7')]||'';this[_0x822f('0x8')]=_0x772254[_0x822f('0x8')]||0xa;this['strategy']=_0x772254['strategy']||_0x822f('0x9');this[_0x822f('0xa')]=_0x772254[_0x822f('0xa')];this['mapAgentsId']={};this['waiting']=0x0;this[_0x822f('0x1')]='';this[_0x822f('0xb')]();this[_0x822f('0xc')]();}ChatQueue[_0x822f('0xd')]['updateRouting']=function(){var _0x4b30ad=this[_0x822f('0xe')]['_rr'];this[_0x822f('0xe')]=_['map'](this['Agents'],'id');this[_0x822f('0xe')][_0x822f('0xf')]=_0x4b30ad;};ChatQueue[_0x822f('0xd')]['updateRealtime']=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x3e6103=0x0;_0x3e6103<this['Agents'][_0x822f('0x10')];_0x3e6103+=0x1){if(this[_0x822f('0xa')][_0x3e6103][_0x822f('0x11')]){this[_0x822f('0x12')]+=0x1;}if(this[_0x822f('0xa')][_0x3e6103][_0x822f('0x13')]){this[_0x822f('0x14')]+=0x1;}}this[_0x822f('0x15')]=this['loggedIn']-this[_0x822f('0x14')];this[_0x822f('0x15')]=this[_0x822f('0x15')]>=0x0?this[_0x822f('0x15')]:0x0;var _0x1659c0={'id':this['id'],'available':this[_0x822f('0x15')],'loggedIn':this[_0x822f('0x12')],'name':this[_0x822f('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x4e4944=md5(JSON[_0x822f('0x16')](_0x1659c0));if(this[_0x822f('0x1')]!==_0x4e4944){this[_0x822f('0x1')]=_0x4e4944;io['to'](util[_0x822f('0x17')](_0x822f('0x18'),_0x1659c0[_0x822f('0x7')]))[_0x822f('0x19')]('chat_queue:save',_0x1659c0);}};module[_0x822f('0x1a')]=ChatQueue;
\ No newline at end of file
+var _0xe536=['emit','exports','lodash','md5','util','ioredis','../../../config/environment','defaults','redis','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','mapAgentsId','_rr','map','prototype','loggedIn','paused','length','chatPause','available','format','chat:queue:%s'];(function(_0x15cede,_0x3f1bbf){var _0x279ca2=function(_0xed21f8){while(--_0xed21f8){_0x15cede['push'](_0x15cede['shift']());}};_0x279ca2(++_0x3f1bbf);}(_0xe536,0x1ef));var _0x6e53=function(_0x387987,_0xd3c5a1){_0x387987=_0x387987-0x0;var _0x523042=_0xe536[_0x387987];return _0x523042;};'use strict';var _=require(_0x6e53('0x0'));var md5=require(_0x6e53('0x1'));var util=require(_0x6e53('0x2'));var Redis=require(_0x6e53('0x3'));var config=require(_0x6e53('0x4'));config['redis']=_[_0x6e53('0x5')](config[_0x6e53('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x6e53('0x7'))(new Redis(config[_0x6e53('0x6')]));function ChatQueue(_0x21d86e){this['id']=_0x21d86e['id']||0x0;this['name']=_0x21d86e[_0x6e53('0x8')]||'';this[_0x6e53('0x9')]=_0x21d86e['timeout']||0xa;this[_0x6e53('0xa')]=_0x21d86e['strategy']||_0x6e53('0xb');this[_0x6e53('0xc')]=_0x21d86e[_0x6e53('0xc')];this['mapAgentsId']={};this[_0x6e53('0xd')]=0x0;this[_0x6e53('0x1')]='';this[_0x6e53('0xe')]();this[_0x6e53('0xf')]();}ChatQueue['prototype']['updateRouting']=function(){var _0x1b472e=this[_0x6e53('0x10')][_0x6e53('0x11')];this[_0x6e53('0x10')]=_[_0x6e53('0x12')](this['Agents'],'id');this[_0x6e53('0x10')][_0x6e53('0x11')]=_0x1b472e;};ChatQueue[_0x6e53('0x13')][_0x6e53('0xf')]=function(){this[_0x6e53('0x14')]=0x0;this[_0x6e53('0x15')]=0x0;for(var _0x263781=0x0;_0x263781<this[_0x6e53('0xc')][_0x6e53('0x16')];_0x263781+=0x1){if(this[_0x6e53('0xc')][_0x263781]['online']){this[_0x6e53('0x14')]+=0x1;}if(this['Agents'][_0x263781][_0x6e53('0x17')]){this[_0x6e53('0x15')]+=0x1;}}this[_0x6e53('0x18')]=this[_0x6e53('0x14')]-this[_0x6e53('0x15')];this[_0x6e53('0x18')]=this['available']>=0x0?this[_0x6e53('0x18')]:0x0;var _0x16d3f7={'id':this['id'],'available':this['available'],'loggedIn':this[_0x6e53('0x14')],'name':this[_0x6e53('0x8')],'paused':this['paused'],'waiting':this['waiting']};var _0x2a7fc5=md5(JSON['stringify'](_0x16d3f7));if(this[_0x6e53('0x1')]!==_0x2a7fc5){this[_0x6e53('0x1')]=_0x2a7fc5;io['to'](util[_0x6e53('0x19')](_0x6e53('0x1a'),_0x16d3f7['name']))[_0x6e53('0x1b')]('chat_queue:save',_0x16d3f7);}};module[_0x6e53('0x1c')]=ChatQueue;
\ No newline at end of file