Built motion from commit 10af8726.|2.6.34
[motion2.git] / server / services / routing / model / chatQueue.js
index 2fb90c2..4a97769 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5e95=['socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','md5','updateRealtime','prototype','_rr','loggedIn','paused','length','chatPause','available','stringify','chat:queue:%s','emit','exports','lodash','util','../../../config/environment','redis','defaults','localhost'];(function(_0x22339d,_0x1a2192){var _0x4d60b9=function(_0xd9d961){while(--_0xd9d961){_0x22339d['push'](_0x22339d['shift']());}};_0x4d60b9(++_0x1a2192);}(_0x5e95,0x7c));var _0x55e9=function(_0x14ae74,_0x4bdee5){_0x14ae74=_0x14ae74-0x0;var _0x1116f3=_0x5e95[_0x14ae74];return _0x1116f3;};'use strict';var _=require(_0x55e9('0x0'));var md5=require('md5');var util=require(_0x55e9('0x1'));var Redis=require('ioredis');var config=require(_0x55e9('0x2'));config[_0x55e9('0x3')]=_[_0x55e9('0x4')](config[_0x55e9('0x3')],{'host':_0x55e9('0x5'),'port':0x18eb});var io=require(_0x55e9('0x6'))(new Redis(config[_0x55e9('0x3')]));function ChatQueue(_0x5f37cf){this['id']=_0x5f37cf['id']||0x0;this['name']=_0x5f37cf[_0x55e9('0x7')]||'';this['timeout']=_0x5f37cf[_0x55e9('0x8')]||0xa;this['strategy']=_0x5f37cf[_0x55e9('0x9')]||'beepall';this['Agents']=_0x5f37cf[_0x55e9('0xa')];this[_0x55e9('0xb')]={};this[_0x55e9('0xc')]=0x0;this[_0x55e9('0xd')]='';this['updateRouting']();this[_0x55e9('0xe')]();}ChatQueue[_0x55e9('0xf')]['updateRouting']=function(){var _0x53908c=this[_0x55e9('0xb')][_0x55e9('0x10')];this[_0x55e9('0xb')]=_['map'](this[_0x55e9('0xa')],'id');this[_0x55e9('0xb')][_0x55e9('0x10')]=_0x53908c;};ChatQueue[_0x55e9('0xf')][_0x55e9('0xe')]=function(){this[_0x55e9('0x11')]=0x0;this[_0x55e9('0x12')]=0x0;for(var _0xf43c6b=0x0;_0xf43c6b<this[_0x55e9('0xa')][_0x55e9('0x13')];_0xf43c6b+=0x1){if(this[_0x55e9('0xa')][_0xf43c6b]['online']){this[_0x55e9('0x11')]+=0x1;}if(this[_0x55e9('0xa')][_0xf43c6b][_0x55e9('0x14')]){this['paused']+=0x1;}}this[_0x55e9('0x15')]=this[_0x55e9('0x11')]-this[_0x55e9('0x12')];this[_0x55e9('0x15')]=this[_0x55e9('0x15')]>=0x0?this[_0x55e9('0x15')]:0x0;var _0x560510={'id':this['id'],'available':this[_0x55e9('0x15')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x55e9('0x12')],'waiting':this[_0x55e9('0xc')]};var _0x1925fb=md5(JSON[_0x55e9('0x16')](_0x560510));if(this[_0x55e9('0xd')]!==_0x1925fb){this['md5']=_0x1925fb;io['to'](util['format'](_0x55e9('0x17'),_0x560510[_0x55e9('0x7')]))[_0x55e9('0x18')]('chat_queue:save',_0x560510);}};module[_0x55e9('0x19')]=ChatQueue;
\ No newline at end of file
+var _0xab01=['socket.io-emitter','name','timeout','strategy','beepall','mapAgentsId','updateRealtime','_rr','map','prototype','Agents','length','online','loggedIn','chatPause','paused','available','waiting','stringify','chat:queue:%s','emit','chat_queue:save','exports','md5','ioredis','../../../config/environment','redis','defaults','localhost'];(function(_0x2a7b50,_0x545d55){var _0x4224c9=function(_0x2b96f6){while(--_0x2b96f6){_0x2a7b50['push'](_0x2a7b50['shift']());}};_0x4224c9(++_0x545d55);}(_0xab01,0x139));var _0x1ab0=function(_0x483657,_0x4c9172){_0x483657=_0x483657-0x0;var _0xe9877c=_0xab01[_0x483657];return _0xe9877c;};'use strict';var _=require('lodash');var md5=require(_0x1ab0('0x0'));var util=require('util');var Redis=require(_0x1ab0('0x1'));var config=require(_0x1ab0('0x2'));config[_0x1ab0('0x3')]=_[_0x1ab0('0x4')](config[_0x1ab0('0x3')],{'host':_0x1ab0('0x5'),'port':0x18eb});var io=require(_0x1ab0('0x6'))(new Redis(config[_0x1ab0('0x3')]));function ChatQueue(_0x375911){this['id']=_0x375911['id']||0x0;this[_0x1ab0('0x7')]=_0x375911['name']||'';this[_0x1ab0('0x8')]=_0x375911[_0x1ab0('0x8')]||0xa;this[_0x1ab0('0x9')]=_0x375911['strategy']||_0x1ab0('0xa');this['Agents']=_0x375911['Agents'];this[_0x1ab0('0xb')]={};this['waiting']=0x0;this['md5']='';this['updateRouting']();this[_0x1ab0('0xc')]();}ChatQueue['prototype']['updateRouting']=function(){var _0x5eeb54=this[_0x1ab0('0xb')][_0x1ab0('0xd')];this['mapAgentsId']=_[_0x1ab0('0xe')](this['Agents'],'id');this[_0x1ab0('0xb')][_0x1ab0('0xd')]=_0x5eeb54;};ChatQueue[_0x1ab0('0xf')][_0x1ab0('0xc')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0xc55fa2=0x0;_0xc55fa2<this[_0x1ab0('0x10')][_0x1ab0('0x11')];_0xc55fa2+=0x1){if(this[_0x1ab0('0x10')][_0xc55fa2][_0x1ab0('0x12')]){this[_0x1ab0('0x13')]+=0x1;}if(this[_0x1ab0('0x10')][_0xc55fa2][_0x1ab0('0x14')]){this[_0x1ab0('0x15')]+=0x1;}}this[_0x1ab0('0x16')]=this[_0x1ab0('0x13')]-this[_0x1ab0('0x15')];this[_0x1ab0('0x16')]=this['available']>=0x0?this['available']:0x0;var _0x1268d6={'id':this['id'],'available':this[_0x1ab0('0x16')],'loggedIn':this[_0x1ab0('0x13')],'name':this[_0x1ab0('0x7')],'paused':this['paused'],'waiting':this[_0x1ab0('0x17')]};var _0x742e02=md5(JSON[_0x1ab0('0x18')](_0x1268d6));if(this[_0x1ab0('0x0')]!==_0x742e02){this[_0x1ab0('0x0')]=_0x742e02;io['to'](util['format'](_0x1ab0('0x19'),_0x1268d6['name']))[_0x1ab0('0x1a')](_0x1ab0('0x1b'),_0x1268d6);}};module[_0x1ab0('0x1c')]=ChatQueue;
\ No newline at end of file