Built motion from commit (unavailable).|2.5.31
[motion2.git] / server / config / schedule / chat.js
index 2405ee7..d482ecc 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd71b=['../../mysqldb','../logger','schedule','redis','defaults','localhost','Setting','find','then','chatTimeout','ChatInteraction','findAll','lastMsgAt','subtract','minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','lodash','moment','util','../../config/environment'];(function(_0xb5f4f6,_0x44e6f0){var _0x45fbc0=function(_0x3de6e5){while(--_0x3de6e5){_0xb5f4f6['push'](_0xb5f4f6['shift']());}};_0x45fbc0(++_0x44e6f0);}(_0xd71b,0x15a));var _0xbd71=function(_0x1823a0,_0x38947d){_0x1823a0=_0x1823a0-0x0;var _0x2b780c=_0xd71b[_0x1823a0];return _0x2b780c;};'use strict';var _=require(_0xbd71('0x0'));var moment=require(_0xbd71('0x1'));var Redis=require('ioredis');var util=require(_0xbd71('0x2'));var config=require(_0xbd71('0x3'));var db=require(_0xbd71('0x4'))['db'];var logger=require(_0xbd71('0x5'))(_0xbd71('0x6'));config[_0xbd71('0x7')]=_[_0xbd71('0x8')](config[_0xbd71('0x7')],{'host':_0xbd71('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xbd71('0x7')]));function closeInteractions(){var _0x162c44=0x0;var _0x18173f=[];return db[_0xbd71('0xa')][_0xbd71('0xb')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0xbd71('0xc')](function(_0x17d23b){_0x162c44=_0x17d23b[_0xbd71('0xd')];if(_0x162c44){return db[_0xbd71('0xe')][_0xbd71('0xf')]({'raw':!![],'attributes':['id',_0xbd71('0x10')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xbd71('0x11')](_0x17d23b[_0xbd71('0xd')],_0xbd71('0x12'))}}});}else{return[];}})[_0xbd71('0xc')](function(_0xbb5c86){if(_0xbb5c86&&_0xbb5c86[_0xbd71('0x13')]){_0x18173f=_[_0xbd71('0x14')](_0xbb5c86||[],'id');logger[_0xbd71('0x15')](_0xbd71('0x16'),_0x18173f[_0xbd71('0x17')]());return db['ChatInteraction'][_0xbd71('0x18')]({'closeReason':'system','disposition':_0xbd71('0x19'),'closed':!![],'closedAt':moment()[_0xbd71('0x1a')](_0xbd71('0x1b'))},{'where':{'id':_0x18173f}});}})[_0xbd71('0xc')](function(){if(_0x18173f&&_0x18173f[_0xbd71('0x13')]){logger[_0xbd71('0x15')](_0xbd71('0x1c'),_0x18173f[_0xbd71('0x17')]());for(var _0x1c694e=0x0;_0x1c694e<_0x18173f[_0xbd71('0x13')];_0x1c694e++){io[_0xbd71('0x1d')](_0xbd71('0x1e'),{'id':_0x18173f[_0x1c694e],'closed':!![]});}}})[_0xbd71('0x1f')](function(_0x11c765){logger[_0xbd71('0x20')](_0xbd71('0x21'),_0x11c765?util[_0xbd71('0x22')](_0x11c765,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();};
\ No newline at end of file
+var _0x5526=['lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','find','then','ChatInteraction','findAll','chatTimeout','minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','timeout','format','YYYY-MM-DD\x20HH:mm:ss','join','emit','chatInteraction:update','error','[CHAT]\x20Error\x20closing\x20interactions','start'];(function(_0x4f3cb8,_0x445472){var _0x42f455=function(_0x2d29ba){while(--_0x2d29ba){_0x4f3cb8['push'](_0x4f3cb8['shift']());}};_0x42f455(++_0x445472);}(_0x5526,0xb4));var _0x6552=function(_0xf03f9e,_0x2f85e8){_0xf03f9e=_0xf03f9e-0x0;var _0x2326a7=_0x5526[_0xf03f9e];return _0x2326a7;};'use strict';var _=require(_0x6552('0x0'));var moment=require(_0x6552('0x1'));var Redis=require(_0x6552('0x2'));var util=require(_0x6552('0x3'));var config=require(_0x6552('0x4'));var db=require(_0x6552('0x5'))['db'];var logger=require(_0x6552('0x6'))(_0x6552('0x7'));config[_0x6552('0x8')]=_[_0x6552('0x9')](config[_0x6552('0x8')],{'host':_0x6552('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6552('0x8')]));function closeInteractions(){var _0x503f4b=0x0;var _0x53951e=[];return db['Setting'][_0x6552('0xb')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0x6552('0xc')](function(_0x3316fe){_0x503f4b=_0x3316fe['chatTimeout'];if(_0x503f4b){return db[_0x6552('0xd')][_0x6552('0xe')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x3316fe[_0x6552('0xf')],_0x6552('0x10'))}}});}else{return[];}})[_0x6552('0xc')](function(_0xf916f3){if(_0xf916f3&&_0xf916f3[_0x6552('0x11')]){_0x53951e=_[_0x6552('0x12')](_0xf916f3||[],'id');logger[_0x6552('0x13')](_0x6552('0x14'),_0x53951e['join']());return db[_0x6552('0xd')]['update']({'closeReason':'system','disposition':_0x6552('0x15'),'closed':!![],'closedAt':moment()[_0x6552('0x16')](_0x6552('0x17'))},{'where':{'id':_0x53951e}});}})['then'](function(){if(_0x53951e&&_0x53951e[_0x6552('0x11')]){logger['info']('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x53951e[_0x6552('0x18')]());for(var _0x5e828a=0x0;_0x5e828a<_0x53951e[_0x6552('0x11')];_0x5e828a++){io[_0x6552('0x19')](_0x6552('0x1a'),{'id':_0x53951e[_0x5e828a],'closed':!![]});}}})['catch'](function(_0x185ef1){logger[_0x6552('0x1b')](_0x6552('0x1c'),_0x185ef1?util['inspect'](_0x185ef1,{'showHidden':![],'depth':null}):'');});}exports[_0x6552('0x1d')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();};
\ No newline at end of file