Built motion from commit (unavailable).|2.5.6
[motion2.git] / server / services / routing / model / chatQueue.js
index 03cafca..c0e18ef 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x85be=['loggedIn','paused','length','online','available','stringify','format','emit','chat_queue:save','exports','lodash','md5','../../../config/environment','redis','defaults','name','timeout','strategy','beepall','Agents','waiting','updateRouting','mapAgentsId','map','_rr'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x85be,0x19a));var _0xe85b=function(_0xd1f665,_0x3986bf){_0xd1f665=_0xd1f665-0x0;var _0x3d1248=_0x85be[_0xd1f665];return _0x3d1248;};'use strict';var _=require(_0xe85b('0x0'));var md5=require(_0xe85b('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0xe85b('0x2'));config[_0xe85b('0x3')]=_[_0xe85b('0x4')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe85b('0x3')]));function ChatQueue(_0x1993fa){this['id']=_0x1993fa['id']||0x0;this[_0xe85b('0x5')]=_0x1993fa[_0xe85b('0x5')]||'';this[_0xe85b('0x6')]=_0x1993fa['timeout']||0xa;this[_0xe85b('0x7')]=_0x1993fa['strategy']||_0xe85b('0x8');this[_0xe85b('0x9')]=_0x1993fa['Agents'];this['mapAgentsId']={};this[_0xe85b('0xa')]=0x0;this[_0xe85b('0x1')]='';this[_0xe85b('0xb')]();this['updateRealtime']();}ChatQueue['prototype'][_0xe85b('0xb')]=function(){var _0x5d3b0a=this[_0xe85b('0xc')]['_rr'];this[_0xe85b('0xc')]=_[_0xe85b('0xd')](this[_0xe85b('0x9')],'id');this[_0xe85b('0xc')][_0xe85b('0xe')]=_0x5d3b0a;};ChatQueue['prototype']['updateRealtime']=function(){this[_0xe85b('0xf')]=0x0;this[_0xe85b('0x10')]=0x0;for(var _0x4faea5=0x0;_0x4faea5<this[_0xe85b('0x9')][_0xe85b('0x11')];_0x4faea5+=0x1){if(this[_0xe85b('0x9')][_0x4faea5][_0xe85b('0x12')]){this['loggedIn']+=0x1;}if(this[_0xe85b('0x9')][_0x4faea5]['chatPause']){this[_0xe85b('0x10')]+=0x1;}}this[_0xe85b('0x13')]=this[_0xe85b('0xf')]-this[_0xe85b('0x10')];this['available']=this[_0xe85b('0x13')]>=0x0?this[_0xe85b('0x13')]:0x0;var _0x2ad6b3={'id':this['id'],'available':this[_0xe85b('0x13')],'loggedIn':this[_0xe85b('0xf')],'name':this['name'],'paused':this[_0xe85b('0x10')],'waiting':this[_0xe85b('0xa')]};var _0x489e63=md5(JSON[_0xe85b('0x14')](_0x2ad6b3));if(this[_0xe85b('0x1')]!==_0x489e63){this[_0xe85b('0x1')]=_0x489e63;io['to'](util[_0xe85b('0x15')]('chat:queue:%s',_0x2ad6b3[_0xe85b('0x5')]))[_0xe85b('0x16')](_0xe85b('0x17'),_0x2ad6b3);}};module[_0xe85b('0x18')]=ChatQueue;
\ No newline at end of file
+var _0xb81c=['md5','util','../../../config/environment','redis','defaults','localhost','name','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','_rr','map','loggedIn','paused','chatPause','available','stringify','format','chat:queue:%s','emit','chat_queue:save','exports'];(function(_0x480a51,_0x3aecea){var _0x19673b=function(_0x28a612){while(--_0x28a612){_0x480a51['push'](_0x480a51['shift']());}};_0x19673b(++_0x3aecea);}(_0xb81c,0x152));var _0xcb81=function(_0x33fe91,_0x2aa1dd){_0x33fe91=_0x33fe91-0x0;var _0x234322=_0xb81c[_0x33fe91];return _0x234322;};'use strict';var _=require('lodash');var md5=require(_0xcb81('0x0'));var util=require(_0xcb81('0x1'));var Redis=require('ioredis');var config=require(_0xcb81('0x2'));config[_0xcb81('0x3')]=_[_0xcb81('0x4')](config[_0xcb81('0x3')],{'host':_0xcb81('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xcb81('0x3')]));function ChatQueue(_0x42d092){this['id']=_0x42d092['id']||0x0;this[_0xcb81('0x6')]=_0x42d092[_0xcb81('0x6')]||'';this['timeout']=_0x42d092['timeout']||0xa;this[_0xcb81('0x7')]=_0x42d092[_0xcb81('0x7')]||_0xcb81('0x8');this[_0xcb81('0x9')]=_0x42d092['Agents'];this[_0xcb81('0xa')]={};this[_0xcb81('0xb')]=0x0;this[_0xcb81('0x0')]='';this['updateRouting']();this[_0xcb81('0xc')]();}ChatQueue[_0xcb81('0xd')]['updateRouting']=function(){var _0x4a9461=this[_0xcb81('0xa')][_0xcb81('0xe')];this['mapAgentsId']=_[_0xcb81('0xf')](this[_0xcb81('0x9')],'id');this['mapAgentsId'][_0xcb81('0xe')]=_0x4a9461;};ChatQueue['prototype'][_0xcb81('0xc')]=function(){this[_0xcb81('0x10')]=0x0;this[_0xcb81('0x11')]=0x0;for(var _0x412fb=0x0;_0x412fb<this[_0xcb81('0x9')]['length'];_0x412fb+=0x1){if(this[_0xcb81('0x9')][_0x412fb]['online']){this[_0xcb81('0x10')]+=0x1;}if(this['Agents'][_0x412fb][_0xcb81('0x12')]){this[_0xcb81('0x11')]+=0x1;}}this[_0xcb81('0x13')]=this['loggedIn']-this['paused'];this['available']=this[_0xcb81('0x13')]>=0x0?this[_0xcb81('0x13')]:0x0;var _0x5dc199={'id':this['id'],'available':this[_0xcb81('0x13')],'loggedIn':this[_0xcb81('0x10')],'name':this[_0xcb81('0x6')],'paused':this[_0xcb81('0x11')],'waiting':this['waiting']};var _0x5f2023=md5(JSON[_0xcb81('0x14')](_0x5dc199));if(this[_0xcb81('0x0')]!==_0x5f2023){this['md5']=_0x5f2023;io['to'](util[_0xcb81('0x15')](_0xcb81('0x16'),_0x5dc199[_0xcb81('0x6')]))[_0xcb81('0x17')](_0xcb81('0x18'),_0x5dc199);}};module[_0xcb81('0x19')]=ChatQueue;
\ No newline at end of file