a16d6ebcf7273e157a7e78df88899b710a0d439e
[motion.git] / server / config / imap / imap.js
1 var _0x2373=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x75\x74\x69\x6C","\x70\x61\x74\x68","\x6C\x6F\x64\x61\x73\x68","\x62\x6C\x75\x65\x62\x69\x72\x64","\x6D\x61\x69\x6C\x2D\x6C\x69\x73\x74\x65\x6E\x65\x72\x32","\x77\x72\x69\x74\x65\x46\x69\x6C\x65","\x66\x73","\x70\x72\x6F\x6D\x69\x73\x69\x66\x79","\x68\x74\x6D\x6C\x2D\x74\x6F\x2D\x74\x65\x78\x74","\x2E\x2E\x2F\x65\x6E\x76\x69\x72\x6F\x6E\x6D\x65\x6E\x74","\x6D\x61\x69\x6C","\x2E\x2E\x2F\x6C\x6F\x67\x67\x65\x72\x2E\x6A\x73","\x4D\x61\x69\x6C\x53\x65\x72\x76\x65\x72\x49\x6E","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x4D\x61\x69\x6C\x52\x6F\x6F\x6D","\x4D\x61\x69\x6C\x4D\x65\x73\x73\x61\x67\x65","\x4D\x61\x69\x6C\x41\x63\x63\x6F\x75\x6E\x74","\x4D\x61\x69\x6C\x41\x74\x74\x61\x63\x68\x6D\x65\x6E\x74","\x65\x72\x72\x6F\x72","\x49\x4D\x41\x50\x20\x50\x52\x4F\x43\x45\x53\x53\x20\x25\x73\x20\x45\x52\x52\x4F\x52","\x61\x72\x67\x76","\x66\x6F\x72\x6D\x61\x74","\x6F\x6E","\x63\x6C\x6F\x73\x65","\x49\x4D\x41\x50\x20\x53\x45\x52\x56\x45\x52\x20\x25\x73\x20\x45\x58\x49\x54\x45\x44\x20\x57\x49\x54\x48\x20\x43\x4F\x44\x45\x20\x25\x73\x2C\x20\x50\x52\x4F\x43\x45\x53\x53\x20\x49\x44\x3A\x20\x25\x73\x20","\x70\x69\x64","\x64\x65\x62\x75\x67","\x49\x4D\x41\x50\x20\x53\x45\x52\x56\x45\x52\x20\x25\x73\x20\x53\x54\x41\x52\x54\x49\x4E\x47\x2C\x20\x50\x52\x4F\x43\x45\x53\x53\x20\x49\x44\x3A\x20\x25\x73\x20","\x69\x6E\x66\x6F","\x73\x74\x61\x74\x65","\x43\x4F\x4E\x4E\x45\x43\x54\x49\x4E\x47","\x73\x65\x6E\x64","\x67\x63","\x47\x61\x72\x62\x61\x67\x65\x20\x63\x6F\x6C\x6C\x65\x63\x74\x69\x6F\x6E\x20\x75\x6E\x61\x76\x61\x69\x6C\x61\x62\x6C\x65\x2E\x20\x20\x50\x61\x73\x73\x20\x2D\x2D\x65\x78\x70\x6F\x73\x65\x2D\x67\x63\x20","\x77\x68\x65\x6E\x20\x6C\x61\x75\x6E\x63\x68\x69\x6E\x67\x20\x6E\x6F\x64\x65\x20\x74\x6F\x20\x65\x6E\x61\x62\x6C\x65\x20\x66\x6F\x72\x63\x65\x64\x20\x67\x61\x72\x62\x61\x67\x65\x20\x63\x6F\x6C\x6C\x65\x63\x74\x69\x6F\x6E\x2E","\x77\x61\x72\x6E","\x73\x74\x6F\x70","\x49\x4D\x41\x50\x20\x53\x45\x52\x56\x45\x52\x20\x25\x73\x20\x4E\x45\x57\x20\x4D\x53\x47\x20\x46\x52\x4F\x4D\x20\x25\x73\x20","\x3B","\x6A\x6F\x69\x6E","\x66\x72\x6F\x6D","\x61\x64\x64\x72\x65\x73\x73","\x6D\x61\x70","\x74\x65\x78\x74","\x68\x74\x6D\x6C","\x66\x72\x6F\x6D\x53\x74\x72\x69\x6E\x67","\x74\x79\x70\x65","\x6D\x73\x67","\x6D\x61\x69\x6C\x53\x65\x72\x76\x65\x72\x49\x6E\x49\x64","\x6D\x61\x69\x6C\x41\x63\x63\x6F\x75\x6E\x74\x49\x64","\x49\x4D\x41\x50\x20\x53\x45\x52\x56\x45\x52\x20\x25\x73\x20\x45\x52\x52\x4F\x52\x2C\x20\x50\x52\x4F\x43\x45\x53\x53\x20\x49\x44\x3A\x20\x25\x73\x20","\x75\x73\x65\x72\x6E\x61\x6D\x65","\x73\x74\x61\x63\x6B","\x45\x52\x52\x4F\x52","\x73\x74\x72\x69\x6E\x67\x69\x66\x79","\x73\x65\x72\x76\x65\x72\x3A\x63\x6F\x6E\x6E\x65\x63\x74\x65\x64","\x49\x4D\x41\x50\x20\x53\x45\x52\x56\x45\x52\x20\x25\x73\x20\x43\x4F\x4E\x4E\x45\x43\x54\x45\x44\x2C\x20\x50\x52\x4F\x43\x45\x53\x53\x20\x49\x44\x3A\x20\x25\x73\x20","\x43\x4F\x4E\x4E\x45\x43\x54\x45\x44","\x70\x61\x73\x73\x77\x6F\x72\x64","\x68\x6F\x73\x74","\x70\x6F\x72\x74","\x73\x73\x6C","\x6D\x61\x69\x6C\x62\x6F\x78","\x66\x69\x6C\x74\x65\x72","\x63\x6F\x6E\x6E\x54\x69\x6D\x65\x6F\x75\x74","\x61\x75\x74\x68\x54\x69\x6D\x65\x6F\x75\x74","\x6B\x65\x65\x70\x61\x6C\x69\x76\x65","\x69\x64","\x4D\x61\x69\x6C\x41\x63\x63\x6F\x75\x6E\x74\x49\x64","\x73\x74\x61\x72\x74","\x70\x6F\x6C\x6C\x69\x6E\x67\x54\x69\x6D\x65","\x63\x61\x74\x63\x68","\x74\x68\x65\x6E","\x66\x69\x6E\x64\x42\x79\x49\x64"];_0x2373[0];var util=require(_0x2373[1]);var path=require(_0x2373[2]);var _=require(_0x2373[3]);var Promise=require(_0x2373[4]);var ImapListener=require(_0x2373[5]);var writeFile=Promise[_0x2373[8]](require(_0x2373[7])[_0x2373[6]]);var htmlToText=require(_0x2373[9]);var config=require(_0x2373[10]);var logger=require(_0x2373[12])(_0x2373[11]);var Server=require(_0x2373[14])[_0x2373[13]];var Room=require(_0x2373[14])[_0x2373[15]];var Message=require(_0x2373[14])[_0x2373[16]];var Account=require(_0x2373[14])[_0x2373[17]];var Attachment=require(_0x2373[14])[_0x2373[18]];var imap;var timeout;process[_0x2373[23]](_0x2373[24],function(_0x98f6x12){logger[_0x2373[27]](util[_0x2373[22]](_0x2373[25],process[_0x2373[21]][3],_0x98f6x12,process[_0x2373[26]]))})[_0x2373[23]](_0x2373[19],function(_0x98f6x11){logger[_0x2373[19]](util[_0x2373[22]](_0x2373[20],process[_0x2373[21]][3]),_0x98f6x11)});logger[_0x2373[29]](util[_0x2373[22]](_0x2373[28],process[_0x2373[21]][3],process[_0x2373[26]]));process[_0x2373[32]]({type:_0x2373[30],state:_0x2373[31]});setInterval(function(){if(global[_0x2373[33]]){global[_0x2373[33]]()}else {logger[_0x2373[36]](_0x2373[34]+ _0x2373[35])}},20000);function onSave(_0x98f6x14){setInterval(function(){if(imap){imap[_0x2373[37]]()};imap= null;imap=  new ImapListener({username:_0x98f6x14[_0x2373[52]],password:_0x98f6x14[_0x2373[59]],host:_0x98f6x14[_0x2373[60]],port:_0x98f6x14[_0x2373[61]],tls:_0x98f6x14[_0x2373[62]],tlsOptions:{rejectUnauthorized:false},mailbox:_0x98f6x14[_0x2373[63]],searchFilter:[_0x98f6x14[_0x2373[64]]],markSeen:true,fetchUnreadOnStart:true,connTimeout:_0x98f6x14[_0x2373[65]]* 1000,authTimeout:_0x98f6x14[_0x2373[66]]* 1000,keepalive:_0x98f6x14[_0x2373[67]]})[_0x2373[23]](_0x2373[56],function(){logger[_0x2373[29]](util[_0x2373[22]](_0x2373[57],_0x98f6x14[_0x2373[52]],process[_0x2373[26]]));process[_0x2373[32]]({type:_0x2373[30],state:_0x2373[58]})})[_0x2373[23]](_0x2373[19],function(_0x98f6x11){logger[_0x2373[19]](util[_0x2373[22]](_0x2373[51],_0x98f6x14[_0x2373[52]],process[_0x2373[26]]),_0x98f6x11[_0x2373[53]]);process[_0x2373[32]]({type:_0x2373[30],state:_0x2373[54],source:JSON[_0x2373[55]](_0x98f6x11)})})[_0x2373[23]](_0x2373[11],function(_0x98f6x15,_0x98f6x16,_0x98f6x17){logger[_0x2373[29]](util[_0x2373[22]](_0x2373[38],process[_0x2373[21]][3],_[_0x2373[43]](_0x98f6x15[_0x2373[41]],_0x2373[42])[_0x2373[40]](_0x2373[39])));if(!_0x98f6x15[_0x2373[44]]){_0x98f6x15[_0x2373[44]]= _0x98f6x15[_0x2373[45]]?htmlToText[_0x2373[46]](_0x98f6x15[_0x2373[45]],{wordwrap:false}):null};_0x98f6x15[_0x2373[47]]= _0x2373[48];_0x98f6x15[_0x2373[49]]= imap[_0x2373[49]];_0x98f6x15[_0x2373[50]]= imap[_0x2373[50]];process[_0x2373[32]](_0x98f6x15)});imap[_0x2373[49]]= _0x98f6x14[_0x2373[68]];imap[_0x2373[50]]= _0x98f6x14[_0x2373[69]];imap[_0x2373[70]]()},_0x98f6x14[_0x2373[71]]?(_0x98f6x14[_0x2373[71]]* 1000):30000)}Server[_0x2373[74]](process[_0x2373[21]][2])[_0x2373[73]](function(_0x98f6x14){onSave(_0x98f6x14)})[_0x2373[72]](function(_0x98f6x11){logger[_0x2373[19]](_0x98f6x11[_0x2373[53]])})