bed69d1c302aeb65fe6c650d9c737f6a5b5cef27
[motion.git] / server / config / imap / index.js
1 var _0x346e=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x75\x74\x69\x6C","\x70\x61\x74\x68","\x63\x68\x69\x6C\x64\x5F\x70\x72\x6F\x63\x65\x73\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\x4D\x65\x73\x73\x61\x67\x65","\x4D\x61\x69\x6C\x52\x6F\x6F\x6D","\x4D\x61\x69\x6C\x52\x6F\x6F\x6D\x53\x74\x61\x74\x75\x73","\x4D\x61\x69\x6C\x41\x63\x63\x6F\x75\x6E\x74","\x43\x6F\x6E\x74\x61\x63\x74","\x43\x6F\x6D\x70\x61\x6E\x79","\x4D\x61\x69\x6C\x41\x74\x74\x61\x63\x68\x6D\x65\x6E\x74","\x52\x65\x70\x6F\x72\x74\x4D\x61\x69\x6C","\x52\x65\x70\x6F\x72\x74\x4D\x61\x69\x6C\x52\x6F\x6F\x6D","\x52\x65\x70\x6F\x72\x74\x4D\x61\x69\x6C\x53\x65\x73\x73\x69\x6F\x6E","\x62\x6C\x75\x65\x62\x69\x72\x64","\x6D\x6F\x6D\x65\x6E\x74","\x6F\x70\x65\x6E","\x66\x73","\x70\x72\x6F\x6D\x69\x73\x69\x66\x79","\x63\x6C\x6F\x73\x65","\x77\x72\x69\x74\x65","\x2E\x2E\x2F\x65\x6E\x76\x69\x72\x6F\x6E\x6D\x65\x6E\x74","\x2E\x2E\x2F\x72\x6F\x75\x74\x69\x6E\x67\x2F\x73\x63\x68\x65\x64\x75\x6C\x65\x72","\x2E\x2E\x2F\x75\x74\x69\x6C","\x69\x6E\x52\x65\x70\x6C\x79\x54\x6F","\x65\x72\x72\x6F\x72","\x63\x61\x74\x63\x68","\x6D\x61\x69\x6C","\x25\x73\x2E\x25\x73","\x75\x6E\x69\x78","\x69\x64","\x66\x6F\x72\x6D\x61\x74","\x73\x75\x62\x6A\x65\x63\x74","\x6E\x61\x6D\x65","\x61\x64\x64\x72\x65\x73\x73","\x66\x72\x6F\x6D","\x63\x63","\x6D\x61\x70","\x64\x61\x74\x61\x56\x61\x6C\x75\x65\x73","\x69\x6E\x69\x74","\x61\x74\x74\x61\x63\x68\x6D\x65\x6E\x74\x73","\x6C\x65\x6E\x67\x74\x68","\x64\x6F\x77\x6E\x6C\x6F\x61\x64\x5F","\x72\x61\x6E\x64\x6F\x6D","\x46\x69\x6C\x65","\x66\x69\x6C\x65\x4E\x61\x6D\x65","\x70\x72\x6F\x70\x65\x72\x6C\x79\x20\x73\x61\x76\x65\x64\x2E","\x6C\x6F\x67","\x74\x68\x65\x6E","\x64\x61\x74\x61","\x63\x6F\x6E\x74\x65\x6E\x74","\x77","\x72\x6F\x6F\x74","\x73\x65\x72\x76\x65\x72","\x66\x69\x6C\x65\x73","\x2F","\x6A\x6F\x69\x6E","\x63\x6F\x6E\x74\x65\x6E\x74\x54\x79\x70\x65","\x63\x72\x65\x61\x74\x65","\x70\x75\x73\x68","\x66\x6F\x72\x45\x61\x63\x68","\x61\x6C\x6C","\x6D\x65\x73\x73\x61\x67\x65\x49\x64","\x52\x45\x43\x45\x49\x56\x45\x44","\x74\x6F","\x62\x63\x63","\x74\x65\x78\x74","\x68\x74\x6D\x6C","\x6D\x61\x69\x6C\x49\x6E","\x75\x70\x64\x61\x74\x65","\x73\x74\x61\x74\x75\x73","\x43\x4C\x4F\x53\x45\x44","\x73\x70\x72\x65\x61\x64","\x4C\x69\x73\x74\x49\x64","\x40","\x73\x70\x6C\x69\x74","\x66\x69\x6E\x64\x4F\x72\x43\x72\x65\x61\x74\x65","\x66\x69\x6E\x64\x4F\x6E\x65","\x6D\x61\x69\x6C\x41\x63\x63\x6F\x75\x6E\x74\x49\x64","\x66\x69\x6E\x64\x42\x79\x49\x64","\x4F\x50\x45\x4E","\x73\x79\x73\x74\x65\x6D","\x3B","\x59\x59\x59\x59\x2D\x4D\x4D\x2D\x44\x44\x20\x48\x48\x3A\x6D\x6D\x3A\x73\x73","\x67\x65\x74\x4D\x61\x69\x6C\x52\x6F\x6F\x6D","\x4D\x61\x69\x6C\x4D\x65\x73\x73\x61\x67\x65\x73","\x4E\x45\x57","\x73\x74\x61\x74\x65","\x73\x6F\x75\x72\x63\x65","\x6F\x6E","\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","\x6D\x65\x73\x73\x61\x67\x65","\x6D\x73\x67","\x74\x79\x70\x65","\x2F\x69\x6D\x61\x70","\x66\x6F\x72\x6B","\x72\x65\x71\x75\x65\x73\x74\x20\x66\x61\x69\x6C\x65\x64\x21","\x72\x65\x71\x75\x65\x73\x74\x20\x73\x75\x63\x63\x65\x73\x73\x65\x66\x75\x6C\x21","\x73\x65\x6E\x64\x52\x65\x71\x75\x65\x73\x74","\x61\x63\x63\x65\x70\x74\x4D\x65\x74\x68\x6F\x64","\x61\x63\x63\x65\x70\x74\x55\x72\x6C","\x4D\x61\x69\x6C\x20\x61\x63\x63\x6F\x75\x6E\x74\x20\x3C","\x3E\x20\x65\x78\x65\x63\x75\x74\x69\x6E\x67\x20\x61\x63\x63\x65\x70\x74\x20\x77\x65\x62\x68\x6F\x6F\x6B","\x61\x63\x74\x69\x6F\x6E\x73","\x65\x6E\x61\x62\x6C\x65\x64","\x65\x78\x65\x63\x41\x63\x74\x69\x6F\x6E","\x61\x63\x63\x65\x70\x74","\x72\x65\x6A\x65\x63\x74\x4D\x65\x74\x68\x6F\x64","\x72\x65\x6A\x65\x63\x74\x55\x72\x6C","\x3E\x20\x65\x78\x65\x63\x75\x74\x69\x6E\x67\x20\x72\x65\x6A\x65\x63\x74\x20\x77\x65\x62\x68\x6F\x6F\x6B","\x72\x65\x6A\x65\x63\x74","\x63\x6C\x6F\x73\x65\x4D\x65\x74\x68\x6F\x64","\x63\x6C\x6F\x73\x65\x55\x72\x6C","\x3E\x20\x65\x78\x65\x63\x75\x74\x69\x6E\x67\x20\x63\x6C\x6F\x73\x65\x20\x77\x65\x62\x68\x6F\x6F\x6B","\x57\x65\x62\x68\x6F\x6F\x6B\x20\x6E\x6F\x74\x20\x72\x65\x63\x6F\x67\x6E\x69\x7A\x65\x64","\x72\x65\x6D\x6F\x76\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x4D\x61\x69\x6C\x20\x61\x63\x63\x6F\x75\x6E\x74\x3A\x20","\x20\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x66\x69\x6E\x64","\x20\x55\x70\x64\x61\x74\x65","\x6D\x65\x72\x67\x65","\x75\x6E\x73\x68\x69\x66\x74","\x61\x66\x74\x65\x72\x55\x70\x64\x61\x74\x65","\x65\x78\x70\x6F\x72\x74\x73","\x65\x78\x69\x74","\x6B\x69\x6C\x6C","\x61\x63\x63\x6F\x75\x6E\x74\x69\x64","\x63\x6F\x6E\x6E\x65\x63\x74\x69\x64","\x63\x68\x61\x6E\x67\x65\x64","\x72\x65\x6A\x65\x63\x74\x65\x64\x41\x74","\x4D\x61\x69\x6C\x41\x63\x63\x6F\x75\x6E\x74\x49\x64","\x66\x69\x6E\x64\x41\x6C\x6C","\x75\x73\x65\x72\x6E\x61\x6D\x65","\x49\x4D\x41\x50\x20\x53\x45\x52\x56\x45\x52\x20\x25\x73\x20\x55\x50\x44\x41\x54\x45\x44\x2C\x20\x50\x52\x4F\x43\x45\x53\x53\x20\x49\x44\x3A\x20\x25\x73\x20","\x70\x69\x64","\x44\x49\x53\x43\x4F\x4E\x4E\x45\x43\x54\x45\x44","\x49\x4D\x41\x50\x20\x53\x45\x52\x56\x45\x52\x20\x25\x73\x20\x44\x45\x53\x54\x52\x4F\x59\x45\x44\x2C\x20\x50\x52\x4F\x43\x45\x53\x53\x20\x49\x44\x3A\x20\x25\x73\x20"];_0x346e[0];const _=require(_0x346e[1]);const util=require(_0x346e[2]);const path=require(_0x346e[3]);const cp=require(_0x346e[4]);const ms=require(_0x346e[6])[_0x346e[5]];const msg=require(_0x346e[6])[_0x346e[7]];const Room=require(_0x346e[6])[_0x346e[8]];const Status=require(_0x346e[6])[_0x346e[9]];const Message=require(_0x346e[6])[_0x346e[7]];const Account=require(_0x346e[6])[_0x346e[10]];const Contact=require(_0x346e[6])[_0x346e[11]];const Company=require(_0x346e[6])[_0x346e[12]];const Attachment=require(_0x346e[6])[_0x346e[13]];const ReportMail=require(_0x346e[6])[_0x346e[14]];const ReportMailRoom=require(_0x346e[6])[_0x346e[15]];const ReportMailSession=require(_0x346e[6])[_0x346e[16]];const Promise=require(_0x346e[17]);const moment=require(_0x346e[18]);const open=Promise[_0x346e[21]](require(_0x346e[20])[_0x346e[19]]);const close=Promise[_0x346e[21]](require(_0x346e[20])[_0x346e[22]]);const write=Promise[_0x346e[21]](require(_0x346e[20])[_0x346e[23]]);const config=require(_0x346e[24]);var mailaccounts;var Scheduler=require(_0x346e[25]);var Util=require(_0x346e[26]);function handleMessage(msg){var _0xb01bx1b;var _0xb01bx1c;var _0xb01bx1d;var _0xb01bx1e;var _0xb01bx1f;var _0xb01bx20,_0xb01bx21,_0xb01bx22,_0xb01bx23;if(msg[_0x346e[27]]){return Message[_0x346e[80]]({where:{messageId:msg[_0x346e[27]][0],accountId:msg[_0x346e[81]]}})[_0x346e[51]](function(_0xb01bx2f){if(_0xb01bx2f){return _0xb01bx2f[_0x346e[87]]()[_0x346e[51]](function(_0xb01bx2e){_0xb01bx1b= _0xb01bx2e;if(_0xb01bx2e[_0x346e[73]]!== _0x346e[74]){return _0xb01bx1b[_0x346e[72]]({status:_0x346e[83],openReason:_0x346e[84]},{individualHooks:true})[_0x346e[51]](function(){return Account[_0x346e[82]](msg[_0x346e[81]])[_0x346e[51]](function(_0xb01bx31){_0xb01bx1d= _0xb01bx31;if(_0xb01bx1d[_0x346e[76]]){return Company[_0x346e[80]]({where:{emailDomain:msg[_0x346e[38]][0][_0x346e[37]][_0x346e[78]](_0x346e[77])[1]}})[_0x346e[51]](function(_0xb01bx32){return Contact[_0x346e[79]]({where:{email:msg[_0x346e[38]][0][_0x346e[37]]},defaults:{email:msg[_0x346e[38]][0][_0x346e[37]],firstName:msg[_0x346e[38]][0][_0x346e[36]]|| msg[_0x346e[38]][0][_0x346e[37]][_0x346e[78]](_0x346e[77])[0],ListId:_0xb01bx1d[_0x346e[76]],CompanyId:_0xb01bx32?_0xb01bx32[_0x346e[33]]:null}})})}else {return []}})[_0x346e[75]](function(_0xb01bx30){_0xb01bx1e= _0xb01bx30})})}else {return Account[_0x346e[82]](msg[_0x346e[81]])[_0x346e[51]](function(_0xb01bx31){_0xb01bx1d= _0xb01bx31;if(_0xb01bx1d[_0x346e[76]]){return Company[_0x346e[80]]({where:{emailDomain:msg[_0x346e[38]][0][_0x346e[37]][_0x346e[78]](_0x346e[77])[1]}})[_0x346e[51]](function(_0xb01bx32){return Contact[_0x346e[79]]({where:{email:msg[_0x346e[38]][0][_0x346e[37]]},defaults:{email:msg[_0x346e[38]][0][_0x346e[37]],firstName:msg[_0x346e[38]][0][_0x346e[36]]|| msg[_0x346e[38]][0][_0x346e[37]][_0x346e[78]](_0x346e[77])[0],ListId:_0xb01bx1d[_0x346e[76]],CompanyId:_0xb01bx32?_0xb01bx32[_0x346e[33]]:null}})})}else {return []}})[_0x346e[75]](function(_0xb01bx30){_0xb01bx1e= _0xb01bx30;return Room[_0x346e[61]]({subject:msg[_0x346e[35]],from:_[_0x346e[40]](msg[_0x346e[38]],_0x346e[37])[_0x346e[59]](_0x346e[85]),account:_0xb01bx1d[_0x346e[36]],attachment:msg[_0x346e[43]]&& msg[_0x346e[43]][_0x346e[44]],lastEvent:_0x346e[66],lastEventAt:moment()[_0x346e[34]](_0x346e[86]),arrivedAt:moment()[_0x346e[34]](_0x346e[86]),MailAccountId:_0xb01bx1d[_0x346e[33]],ParentId:_0xb01bx2e[_0x346e[33]]})})[_0x346e[51]](function(_0xb01bx2e){_0xb01bx1b= _0xb01bx2e})}})}else {return Account[_0x346e[82]](msg[_0x346e[81]])[_0x346e[51]](function(_0xb01bx31){_0xb01bx1d= _0xb01bx31;if(_0xb01bx1d[_0x346e[76]]){return Company[_0x346e[80]]({where:{emailDomain:msg[_0x346e[38]][0][_0x346e[37]][_0x346e[78]](_0x346e[77])[1]}})[_0x346e[51]](function(_0xb01bx32){return Contact[_0x346e[79]]({where:{email:msg[_0x346e[38]][0][_0x346e[37]]},defaults:{email:msg[_0x346e[38]][0][_0x346e[37]],firstName:msg[_0x346e[38]][0][_0x346e[36]]|| msg[_0x346e[38]][0][_0x346e[37]][_0x346e[78]](_0x346e[77])[0],ListId:_0xb01bx1d[_0x346e[76]],CompanyId:_0xb01bx32?_0xb01bx32[_0x346e[33]]:null}})})}else {return []}})[_0x346e[75]](function(_0xb01bx30){_0xb01bx1e= _0xb01bx30;return Room[_0x346e[61]]({subject:msg[_0x346e[35]],from:_[_0x346e[40]](msg[_0x346e[38]],_0x346e[37])[_0x346e[59]](_0x346e[85]),account:_0xb01bx1d[_0x346e[36]],attachment:msg[_0x346e[43]]&& msg[_0x346e[43]][_0x346e[44]],lastEvent:_0x346e[66],lastEventAt:moment()[_0x346e[34]](_0x346e[86]),arrivedAt:moment()[_0x346e[34]](_0x346e[86]),MailAccountId:_0xb01bx1d[_0x346e[33]]})})[_0x346e[51]](function(_0xb01bx2e){_0xb01bx1b= _0xb01bx2e})}})[_0x346e[51]](function(){return _0xb01bx1b[_0x346e[72]]({lastEvent:_0x346e[66],mailIn:++_0xb01bx1b[_0x346e[71]]})})[_0x346e[51]](function(_0xb01bx2e){return Message[_0x346e[61]]({fromId:_0xb01bx1e?_0xb01bx1e[_0x346e[33]]:null,messageId:msg[_0x346e[65]],status:_0x346e[66],subject:msg[_0x346e[35]],from:_[_0x346e[40]](msg[_0x346e[38]],_0x346e[37]),to:msg[_0x346e[67]]?_[_0x346e[40]](msg[_0x346e[67]],_0x346e[37]):[],cc:msg[_0x346e[39]]?_[_0x346e[40]](msg[_0x346e[39]],_0x346e[37]):[],bcc:msg[_0x346e[68]]?_[_0x346e[40]](msg[_0x346e[68]],_0x346e[37]):[],text:msg[_0x346e[69]]|| null,html:msg[_0x346e[70]]|| null,MailRoomId:_0xb01bx1b[_0x346e[33]],accountName:_0xb01bx1d[_0x346e[36]],accountId:_0xb01bx1d[_0x346e[33]],inReplyTo:msg[_0x346e[27]][0]})})[_0x346e[51]](function(_0xb01bx25){var _0xb01bx26=[];var _0xb01bx27=_0xb01bx25;var _0xb01bx28= new Scheduler({channel:_0x346e[30],uniqueid:util[_0x346e[34]](_0x346e[31],moment()[_0x346e[32]](),_0xb01bx1b[_0x346e[33]]),subject:msg[_0x346e[35]],messageid:_0xb01bx27[_0x346e[33]],roomid:_0xb01bx1b[_0x346e[33]],accountid:_0xb01bx1d[_0x346e[33]],accountname:_0xb01bx1d[_0x346e[36]],accountaddress:_0xb01bx1d[_0x346e[37]],from:msg[_0x346e[38]][0][_0x346e[37]],cc:msg[_0x346e[39]]?_[_0x346e[40]](msg[_0x346e[39]],_0x346e[37]):[]},_0xb01bx27[_0x346e[41]]);_0xb01bx28[_0x346e[42]]();if(msg[_0x346e[43]]&& msg[_0x346e[43]][_0x346e[44]]){msg[_0x346e[43]][_0x346e[63]](function(_0xb01bx29){var _0xb01bx2a=_0x346e[45]+ Math[_0x346e[46]](32);var _0xb01bx2b;_0xb01bx26[_0x346e[62]](Attachment[_0x346e[61]]({name:_0xb01bx29[_0x346e[48]],basename:_0xb01bx2a,path:path[_0x346e[59]](config[_0x346e[55]],_0x346e[56],_0x346e[57],_0x346e[43],_0x346e[58],_0xb01bx2a),type:_0xb01bx29[_0x346e[60]],size:_0xb01bx29[_0x346e[44]],MailMessageId:_0xb01bx27[_0x346e[33]]})[_0x346e[51]](function(_0xb01bx2d){return open(_0xb01bx2d[_0x346e[3]],_0x346e[54])})[_0x346e[51]](function(_0xb01bx2c){_0xb01bx2b= _0xb01bx2c;return write(_0xb01bx2b, new Buffer(_0xb01bx29[_0x346e[53]][_0x346e[52]]),0,_0xb01bx29[_0x346e[44]])})[_0x346e[51]](function(){return close(_0xb01bx2b)})[_0x346e[51]](function(){console[_0x346e[50]](_0x346e[47],_0xb01bx29[_0x346e[48]],_0x346e[49])})[_0x346e[29]](function(_0xb01bx24){console[_0x346e[28]](_0xb01bx24)}))})};return Promise[_0x346e[64]](_0xb01bx26)})[_0x346e[29]](function(_0xb01bx24){console[_0x346e[28]](_0xb01bx24)})}else {return Account[_0x346e[82]](msg[_0x346e[81]])[_0x346e[51]](function(_0xb01bx31){_0xb01bx1d= _0xb01bx31;if(_0xb01bx1d[_0x346e[76]]){return Company[_0x346e[80]]({where:{emailDomain:msg[_0x346e[38]][0][_0x346e[37]][_0x346e[78]](_0x346e[77])[1]}})[_0x346e[51]](function(_0xb01bx32){return Contact[_0x346e[79]]({where:{email:msg[_0x346e[38]][0][_0x346e[37]]},defaults:{email:msg[_0x346e[38]][0][_0x346e[37]],firstName:msg[_0x346e[38]][0][_0x346e[36]]|| msg[_0x346e[38]][0][_0x346e[37]][_0x346e[78]](_0x346e[77])[0],ListId:_0xb01bx1d[_0x346e[76]],CompanyId:_0xb01bx32?_0xb01bx32[_0x346e[33]]:null}})})}else {return []}})[_0x346e[75]](function(_0xb01bx30){_0xb01bx1e= _0xb01bx30;return Room[_0x346e[61]]({mailIn:1,account:_0xb01bx1d[_0x346e[36]],subject:msg[_0x346e[35]],from:_[_0x346e[40]](msg[_0x346e[38]],_0x346e[37])[_0x346e[59]](_0x346e[85]),status:_0x346e[89],lastEvent:_0x346e[66],lastEventAt:moment()[_0x346e[34]](_0x346e[86]),arrivedAt:moment()[_0x346e[34]](_0x346e[86]),attachment:msg[_0x346e[43]]&& msg[_0x346e[43]][_0x346e[44]],MailMessages:[{messageId:msg[_0x346e[65]],subject:msg[_0x346e[35]],from:_[_0x346e[40]](msg[_0x346e[38]],_0x346e[37]),fromId:_0xb01bx1e?_0xb01bx1e[_0x346e[33]]:null,to:msg[_0x346e[67]]?_[_0x346e[40]](msg[_0x346e[67]],_0x346e[37]):[],cc:msg[_0x346e[39]]?_[_0x346e[40]](msg[_0x346e[39]],_0x346e[37]):[],bcc:msg[_0x346e[68]]?_[_0x346e[40]](msg[_0x346e[68]],_0x346e[37]):[],status:_0x346e[66],text:msg[_0x346e[69]]|| null,html:msg[_0x346e[70]]|| null,accountName:_0xb01bx1d[_0x346e[36]],accountId:_0xb01bx1d[_0x346e[33]]}],MailAccountId:msg[_0x346e[81]]},{include:[{model:Message}]})})[_0x346e[51]](function(_0xb01bx33){var _0xb01bx26=[];var _0xb01bx34=_0xb01bx33;var _0xb01bx28= new Scheduler({channel:_0x346e[30],uniqueid:util[_0x346e[34]](_0x346e[31],moment()[_0x346e[32]](),_0xb01bx34[_0x346e[33]]),subject:msg[_0x346e[35]],messageid:_0xb01bx34[_0x346e[88]][0][_0x346e[33]],roomid:_0xb01bx34[_0x346e[33]],accountid:_0xb01bx1d[_0x346e[33]],accountname:_0xb01bx1d[_0x346e[36]],accountaddress:_0xb01bx1d[_0x346e[37]],from:msg[_0x346e[38]][0][_0x346e[37]],cc:msg[_0x346e[39]]?_[_0x346e[40]](msg[_0x346e[39]],_0x346e[37]):[]},_0xb01bx34[_0x346e[88]][0][_0x346e[41]]);_0xb01bx28[_0x346e[42]]();if(msg[_0x346e[43]]&& msg[_0x346e[43]][_0x346e[44]]){msg[_0x346e[43]][_0x346e[63]](function(_0xb01bx29){var _0xb01bx2a=_0x346e[45]+ Math[_0x346e[46]](32);var _0xb01bx2b;_0xb01bx26[_0x346e[62]](Attachment[_0x346e[61]]({name:_0xb01bx29[_0x346e[48]],basename:_0xb01bx2a,path:path[_0x346e[59]](config[_0x346e[55]],_0x346e[56],_0x346e[57],_0x346e[43],_0x346e[58],_0xb01bx2a),type:_0xb01bx29[_0x346e[60]],size:_0xb01bx29[_0x346e[44]],MailMessageId:_0xb01bx34[_0x346e[88]][0][_0x346e[33]]})[_0x346e[51]](function(_0xb01bx2d){return open(_0xb01bx2d[_0x346e[3]],_0x346e[54])})[_0x346e[51]](function(_0xb01bx2c){_0xb01bx2b= _0xb01bx2c;return write(_0xb01bx2b, new Buffer(_0xb01bx29[_0x346e[53]][_0x346e[52]]),0,_0xb01bx29[_0x346e[44]])})[_0x346e[51]](function(){return close(_0xb01bx2b)})[_0x346e[51]](function(){console[_0x346e[50]](_0x346e[47],_0xb01bx29[_0x346e[48]],_0x346e[49])})[_0x346e[29]](function(_0xb01bx24){console[_0x346e[28]](_0xb01bx24)}))})};return Promise[_0x346e[64]](_0xb01bx26)})[_0x346e[29]](function(_0xb01bx24){console[_0x346e[28]](_0xb01bx24)})}}function handleState(_0xb01bx36,_0xb01bx37){return ms[_0x346e[82]](_0xb01bx36)[_0x346e[51]](function(_0xb01bx38){return _0xb01bx38[_0x346e[72]]({state:_0xb01bx37[_0x346e[90]],source:_0xb01bx37[_0x346e[91]]|| null})})[_0x346e[29]](function(_0xb01bx24){console[_0x346e[28]](_0xb01bx24)})}function fork(_0xb01bx36,_0xb01bx3a){return cp[_0x346e[98]](__dirname+ _0x346e[97],[_0xb01bx36,_0xb01bx3a])[_0x346e[92]](_0x346e[94],function(_0xb01bx37){switch(_0xb01bx37[_0x346e[96]]){case _0x346e[95]:handleMessage(_0xb01bx37);break;case _0x346e[90]:handleState(_0xb01bx36,_0xb01bx37);break;default:}})[_0x346e[92]](_0x346e[22],function(_0xb01bx3b){console[_0x346e[50]](util[_0x346e[34]](_0x346e[93],_0xb01bx3a,_0xb01bx3b))})[_0x346e[92]](_0x346e[28],function(_0xb01bx24){console[_0x346e[28]](_0xb01bx24)})}function execRequest(_0xb01bx3d,_0xb01bx3e,_0xb01bx3f){Util[_0x346e[101]](_0xb01bx3d,_0xb01bx3e,_0xb01bx3f)[_0x346e[51]](function(_0xb01bx40){console[_0x346e[50]](_0x346e[100])})[_0x346e[29]](function(_0xb01bx24){console[_0x346e[50]](_0x346e[99])})}function webhook(_0xb01bx3d,_0xb01bx42,_0xb01bx43){var _0xb01bx44=_0xb01bx42;switch(_0xb01bx43){case _0x346e[109]:if(_0xb01bx44[_0x346e[102]]&& _0xb01bx44[_0x346e[103]]){console[_0x346e[50]](_0x346e[104]+ _0xb01bx44[_0x346e[36]]+ _0x346e[105]);execRequest(_0xb01bx3d[_0x346e[41]],_0xb01bx44[_0x346e[102]],_0xb01bx44[_0x346e[103]])};if(_0xb01bx44[_0x346e[106]][_0x346e[44]]){_[_0x346e[63]](_0xb01bx44[_0x346e[106]],function(_0xb01bx45){if(_0xb01bx45[_0x346e[107]]){Util[_0x346e[108]](_0xb01bx45,_0xb01bx3d)}})};break;case _0x346e[113]:if(_0xb01bx44[_0x346e[110]]&& _0xb01bx44[_0x346e[111]]){console[_0x346e[50]](_0x346e[104]+ _0xb01bx44[_0x346e[36]]+ _0x346e[112]);execRequest(_0xb01bx3d[_0x346e[41]],_0xb01bx44[_0x346e[110]],_0xb01bx44[_0x346e[111]])};break;case _0x346e[22]:if(_0xb01bx44[_0x346e[114]]&& _0xb01bx44[_0x346e[115]]){console[_0x346e[50]](_0x346e[104]+ _0xb01bx44[_0x346e[36]]+ _0x346e[116]);execRequest(_0xb01bx3d[_0x346e[41]],_0xb01bx44[_0x346e[114]],_0xb01bx44[_0x346e[115]])};break;default:console[_0x346e[50]](_0x346e[117])}}function synch(mailaccounts){Account[_0x346e[119]](function(_0xb01bx3d){_[_0x346e[118]](mailaccounts,{id:_0xb01bx3d[_0x346e[33]]})});Account[_0x346e[122]](function(_0xb01bx3d){console[_0x346e[50]](_0x346e[120]+ _0xb01bx3d[_0x346e[36]]+ _0x346e[121]);mailaccounts[_0x346e[62]](_0xb01bx3d)});Account[_0x346e[127]](function(_0xb01bx3d){var _0xb01bx47=_[_0x346e[123]](mailaccounts,{id:_0xb01bx3d[_0x346e[33]]});if(_0xb01bx47){console[_0x346e[50]](_0x346e[120]+ _0xb01bx47[_0x346e[36]]+ _0x346e[124]);_[_0x346e[125]](_0xb01bx47,_0xb01bx3d)}else {mailaccounts[_0x346e[126]](_0xb01bx3d)}})}module[_0x346e[128]]= function(){var _0xb01bx48={};var _0xb01bx49;process[_0x346e[92]](_0x346e[129],function(_0xb01bx3b){for(var _0xb01bx4a in _0xb01bx48){if(_0xb01bx48[_0xb01bx4a]){_0xb01bx48[_0xb01bx4a][_0x346e[130]]()}}});Account[_0x346e[136]]()[_0x346e[51]](function(_0xb01bx4b){mailaccounts= _0xb01bx4b;synch(mailaccounts);ReportMail[_0x346e[127]](function(_0xb01bx3d){var _0xb01bx42=_[_0x346e[123]](mailaccounts,{id:parseInt(_0xb01bx3d[_0x346e[131]])});if(_0xb01bx42&& _0xb01bx3d[_0x346e[133]](_0x346e[132])){webhook(_0xb01bx3d,_0xb01bx42,_0x346e[109])};if(_0xb01bx42&& _0xb01bx3d[_0x346e[133]](_0x346e[134])){webhook(_0xb01bx3d,_0xb01bx42,_0x346e[113])}});Room[_0x346e[127]](function(_0xb01bx3d){var _0xb01bx42=_[_0x346e[123]](mailaccounts,{id:_0xb01bx3d[_0x346e[135]]});if(_0xb01bx42&& _0xb01bx3d[_0x346e[133]](_0x346e[73])&& _0xb01bx3d[_0x346e[73]]=== _0x346e[74]){webhook(_0xb01bx3d,_0xb01bx42,_0x346e[22])}})})[_0x346e[29]](function(_0xb01bx24){console[_0x346e[28]](_0xb01bx24)});ms[_0x346e[122]](function(_0xb01bx38){_0xb01bx48[_0xb01bx38[_0x346e[33]]]= fork(_0xb01bx38[_0x346e[33]],_0xb01bx38[_0x346e[137]])});ms[_0x346e[127]](function(_0xb01bx38){if(_0xb01bx48[_0xb01bx38[_0x346e[33]]]){if(_0xb01bx38[_0x346e[133]](_0x346e[90])|| _0xb01bx38[_0x346e[133]](_0x346e[91])){console[_0x346e[50]](util[_0x346e[34]](_0x346e[138],_0xb01bx38[_0x346e[33]],_0xb01bx48[_0xb01bx38[_0x346e[33]]][_0x346e[139]]));clearTimeout(_0xb01bx49);switch(_0xb01bx38[_0x346e[90]]){case _0x346e[140]:_0xb01bx49= setTimeout(function(){_0xb01bx48[_0xb01bx38[_0x346e[33]]]= fork(_0xb01bx38[_0x346e[33]],_0xb01bx38[_0x346e[137]])},10000);break;default:}}else {_0xb01bx48[_0xb01bx38[_0x346e[33]]][_0x346e[130]]();_0xb01bx48[_0xb01bx38[_0x346e[33]]]= null;_0xb01bx48[_0xb01bx38[_0x346e[33]]]= fork(_0xb01bx38[_0x346e[33]],_0xb01bx38[_0x346e[137]])}}});ms[_0x346e[119]](function(_0xb01bx38){if(_0xb01bx48[_0xb01bx38[_0x346e[33]]]){console[_0x346e[50]](util[_0x346e[34]](_0x346e[141],_0xb01bx38[_0x346e[33]],_0xb01bx48[_0xb01bx38[_0x346e[33]]][_0x346e[139]]));_0xb01bx48[_0xb01bx38[_0x346e[33]]][_0x346e[130]]();_0xb01bx48[_0xb01bx38[_0x346e[33]]]= null}});ms[_0x346e[136]]()[_0x346e[51]](function(_0xb01bx4c){_0xb01bx4c[_0x346e[63]](function(_0xb01bx38){_0xb01bx48[_0xb01bx38[_0x346e[33]]]= fork(_0xb01bx38[_0x346e[33]],_0xb01bx38[_0x346e[137]])})})[_0x346e[29]](function(_0xb01bx24){console[_0x346e[28]](_0xb01bx24)})}