Built motion from commit 0630df9.|0.0.136
[motion.git] / server / config / imap / index.js
1 var _0xcd7c=["\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","\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","\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","\x72\x65\x6D\x6F\x76\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\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"];_0xcd7c[0];const _=require(_0xcd7c[1]);const util=require(_0xcd7c[2]);const path=require(_0xcd7c[3]);const cp=require(_0xcd7c[4]);const ms=require(_0xcd7c[6])[_0xcd7c[5]];const msg=require(_0xcd7c[6])[_0xcd7c[7]];const Room=require(_0xcd7c[6])[_0xcd7c[8]];const Status=require(_0xcd7c[6])[_0xcd7c[9]];const Message=require(_0xcd7c[6])[_0xcd7c[7]];const Account=require(_0xcd7c[6])[_0xcd7c[10]];const Contact=require(_0xcd7c[6])[_0xcd7c[11]];const Company=require(_0xcd7c[6])[_0xcd7c[12]];const Attachment=require(_0xcd7c[6])[_0xcd7c[13]];const ReportMail=require(_0xcd7c[6])[_0xcd7c[14]];const ReportMailRoom=require(_0xcd7c[6])[_0xcd7c[15]];const ReportMailSession=require(_0xcd7c[6])[_0xcd7c[16]];const Promise=require(_0xcd7c[17]);const moment=require(_0xcd7c[18]);const open=Promise[_0xcd7c[21]](require(_0xcd7c[20])[_0xcd7c[19]]);const close=Promise[_0xcd7c[21]](require(_0xcd7c[20])[_0xcd7c[22]]);const write=Promise[_0xcd7c[21]](require(_0xcd7c[20])[_0xcd7c[23]]);const config=require(_0xcd7c[24]);var mailaccounts;var Scheduler=require(_0xcd7c[25]);var Util=require(_0xcd7c[26]);function handleMessage(msg){var _0x97f2x1b;var _0x97f2x1c;var _0x97f2x1d;var _0x97f2x1e;var _0x97f2x1f;var _0x97f2x20,_0x97f2x21,_0x97f2x22,_0x97f2x23;if(msg[_0xcd7c[27]]){return Message[_0xcd7c[79]]({where:{messageId:msg[_0xcd7c[27]][0]}})[_0xcd7c[51]](function(_0x97f2x2f){if(_0x97f2x2f){return _0x97f2x2f[_0xcd7c[86]]()[_0xcd7c[51]](function(_0x97f2x2e){_0x97f2x1b= _0x97f2x2e;if(_0x97f2x2e[_0xcd7c[72]]!== _0xcd7c[73]){return _0x97f2x1b[_0xcd7c[71]]({status:_0xcd7c[82],openReason:_0xcd7c[83]},{individualHooks:true})[_0xcd7c[51]](function(){return Account[_0xcd7c[81]](msg[_0xcd7c[80]])[_0xcd7c[51]](function(_0x97f2x31){_0x97f2x1d= _0x97f2x31;if(_0x97f2x1d[_0xcd7c[75]]){return Company[_0xcd7c[79]]({where:{emailDomain:msg[_0xcd7c[38]][0][_0xcd7c[37]][_0xcd7c[77]](_0xcd7c[76])[1]}})[_0xcd7c[51]](function(_0x97f2x32){return Contact[_0xcd7c[78]]({where:{email:msg[_0xcd7c[38]][0][_0xcd7c[37]]},defaults:{email:msg[_0xcd7c[38]][0][_0xcd7c[37]],firstName:msg[_0xcd7c[38]][0][_0xcd7c[36]]|| msg[_0xcd7c[38]][0][_0xcd7c[37]][_0xcd7c[77]](_0xcd7c[76])[0],ListId:_0x97f2x1d[_0xcd7c[75]],CompanyId:_0x97f2x32?_0x97f2x32[_0xcd7c[33]]:null}})})}else {return []}})[_0xcd7c[74]](function(_0x97f2x30){_0x97f2x1e= _0x97f2x30})})}else {return Account[_0xcd7c[81]](msg[_0xcd7c[80]])[_0xcd7c[51]](function(_0x97f2x31){_0x97f2x1d= _0x97f2x31;if(_0x97f2x1d[_0xcd7c[75]]){return Company[_0xcd7c[79]]({where:{emailDomain:msg[_0xcd7c[38]][0][_0xcd7c[37]][_0xcd7c[77]](_0xcd7c[76])[1]}})[_0xcd7c[51]](function(_0x97f2x32){return Contact[_0xcd7c[78]]({where:{email:msg[_0xcd7c[38]][0][_0xcd7c[37]]},defaults:{email:msg[_0xcd7c[38]][0][_0xcd7c[37]],firstName:msg[_0xcd7c[38]][0][_0xcd7c[36]]|| msg[_0xcd7c[38]][0][_0xcd7c[37]][_0xcd7c[77]](_0xcd7c[76])[0],ListId:_0x97f2x1d[_0xcd7c[75]],CompanyId:_0x97f2x32?_0x97f2x32[_0xcd7c[33]]:null}})})}else {return []}})[_0xcd7c[74]](function(_0x97f2x30){_0x97f2x1e= _0x97f2x30;return Room[_0xcd7c[61]]({subject:msg[_0xcd7c[35]],from:_[_0xcd7c[40]](msg[_0xcd7c[38]],_0xcd7c[37])[_0xcd7c[59]](_0xcd7c[84]),account:_0x97f2x1d[_0xcd7c[36]],attachment:msg[_0xcd7c[43]]&& msg[_0xcd7c[43]][_0xcd7c[44]],lastEvent:_0xcd7c[66],lastEventAt:moment()[_0xcd7c[34]](_0xcd7c[85]),arrivedAt:moment()[_0xcd7c[34]](_0xcd7c[85]),MailAccountId:_0x97f2x1d[_0xcd7c[33]],ParentId:_0x97f2x2e[_0xcd7c[33]]})})[_0xcd7c[51]](function(_0x97f2x2e){_0x97f2x1b= _0x97f2x2e})}})}else {return Account[_0xcd7c[81]](msg[_0xcd7c[80]])[_0xcd7c[51]](function(_0x97f2x31){_0x97f2x1d= _0x97f2x31;if(_0x97f2x1d[_0xcd7c[75]]){return Company[_0xcd7c[79]]({where:{emailDomain:msg[_0xcd7c[38]][0][_0xcd7c[37]][_0xcd7c[77]](_0xcd7c[76])[1]}})[_0xcd7c[51]](function(_0x97f2x32){return Contact[_0xcd7c[78]]({where:{email:msg[_0xcd7c[38]][0][_0xcd7c[37]]},defaults:{email:msg[_0xcd7c[38]][0][_0xcd7c[37]],firstName:msg[_0xcd7c[38]][0][_0xcd7c[36]]|| msg[_0xcd7c[38]][0][_0xcd7c[37]][_0xcd7c[77]](_0xcd7c[76])[0],ListId:_0x97f2x1d[_0xcd7c[75]],CompanyId:_0x97f2x32?_0x97f2x32[_0xcd7c[33]]:null}})})}else {return []}})[_0xcd7c[74]](function(_0x97f2x30){_0x97f2x1e= _0x97f2x30;return Room[_0xcd7c[61]]({subject:msg[_0xcd7c[35]],from:_[_0xcd7c[40]](msg[_0xcd7c[38]],_0xcd7c[37])[_0xcd7c[59]](_0xcd7c[84]),account:_0x97f2x1d[_0xcd7c[36]],attachment:msg[_0xcd7c[43]]&& msg[_0xcd7c[43]][_0xcd7c[44]],lastEvent:_0xcd7c[66],lastEventAt:moment()[_0xcd7c[34]](_0xcd7c[85]),arrivedAt:moment()[_0xcd7c[34]](_0xcd7c[85]),MailAccountId:_0x97f2x1d[_0xcd7c[33]]})})[_0xcd7c[51]](function(_0x97f2x2e){_0x97f2x1b= _0x97f2x2e})}})[_0xcd7c[51]](function(){return _0x97f2x1b[_0xcd7c[71]]({lastEvent:_0xcd7c[66],mailIn:++_0x97f2x1b[_0xcd7c[70]]})})[_0xcd7c[51]](function(_0x97f2x2e){return Message[_0xcd7c[61]]({fromId:_0x97f2x1e?_0x97f2x1e[_0xcd7c[33]]:null,messageId:msg[_0xcd7c[65]],status:_0xcd7c[66],subject:msg[_0xcd7c[35]],from:_[_0xcd7c[40]](msg[_0xcd7c[38]],_0xcd7c[37]),to:msg[_0xcd7c[67]]?_[_0xcd7c[40]](msg[_0xcd7c[67]],_0xcd7c[37]):[],cc:msg[_0xcd7c[39]]?_[_0xcd7c[40]](msg[_0xcd7c[39]],_0xcd7c[37]):[],bcc:msg[_0xcd7c[68]]?_[_0xcd7c[40]](msg[_0xcd7c[68]],_0xcd7c[37]):[],text:msg[_0xcd7c[69]]|| null,MailRoomId:_0x97f2x1b[_0xcd7c[33]],accountName:_0x97f2x1d[_0xcd7c[36]],accountId:_0x97f2x1d[_0xcd7c[33]]})})[_0xcd7c[51]](function(_0x97f2x25){var _0x97f2x26=[];var _0x97f2x27=_0x97f2x25;var _0x97f2x28= new Scheduler({channel:_0xcd7c[30],uniqueid:util[_0xcd7c[34]](_0xcd7c[31],moment()[_0xcd7c[32]](),_0x97f2x1b[_0xcd7c[33]]),subject:msg[_0xcd7c[35]],messageid:_0x97f2x27[_0xcd7c[33]],roomid:_0x97f2x1b[_0xcd7c[33]],accountid:_0x97f2x1d[_0xcd7c[33]],accountname:_0x97f2x1d[_0xcd7c[36]],accountaddress:_0x97f2x1d[_0xcd7c[37]],from:msg[_0xcd7c[38]][0][_0xcd7c[37]],cc:msg[_0xcd7c[39]]?_[_0xcd7c[40]](msg[_0xcd7c[39]],_0xcd7c[37]):[]},_0x97f2x27[_0xcd7c[41]]);_0x97f2x28[_0xcd7c[42]]();if(msg[_0xcd7c[43]]&& msg[_0xcd7c[43]][_0xcd7c[44]]){msg[_0xcd7c[43]][_0xcd7c[63]](function(_0x97f2x29){var _0x97f2x2a=_0xcd7c[45]+ Math[_0xcd7c[46]](32);var _0x97f2x2b;_0x97f2x26[_0xcd7c[62]](Attachment[_0xcd7c[61]]({name:_0x97f2x29[_0xcd7c[48]],basename:_0x97f2x2a,path:path[_0xcd7c[59]](config[_0xcd7c[55]],_0xcd7c[56],_0xcd7c[57],_0xcd7c[43],_0xcd7c[58],_0x97f2x2a),type:_0x97f2x29[_0xcd7c[60]],size:_0x97f2x29[_0xcd7c[44]],MailMessageId:_0x97f2x27[_0xcd7c[33]]})[_0xcd7c[51]](function(_0x97f2x2d){return open(_0x97f2x2d[_0xcd7c[3]],_0xcd7c[54])})[_0xcd7c[51]](function(_0x97f2x2c){_0x97f2x2b= _0x97f2x2c;return write(_0x97f2x2b, new Buffer(_0x97f2x29[_0xcd7c[53]][_0xcd7c[52]]),0,_0x97f2x29[_0xcd7c[44]])})[_0xcd7c[51]](function(){return close(_0x97f2x2b)})[_0xcd7c[51]](function(){console[_0xcd7c[50]](_0xcd7c[47],_0x97f2x29[_0xcd7c[48]],_0xcd7c[49])})[_0xcd7c[29]](function(_0x97f2x24){console[_0xcd7c[28]](_0x97f2x24)}))})};return Promise[_0xcd7c[64]](_0x97f2x26)})[_0xcd7c[29]](function(_0x97f2x24){console[_0xcd7c[28]](_0x97f2x24)})}else {return Account[_0xcd7c[81]](msg[_0xcd7c[80]])[_0xcd7c[51]](function(_0x97f2x31){_0x97f2x1d= _0x97f2x31;if(_0x97f2x1d[_0xcd7c[75]]){return Company[_0xcd7c[79]]({where:{emailDomain:msg[_0xcd7c[38]][0][_0xcd7c[37]][_0xcd7c[77]](_0xcd7c[76])[1]}})[_0xcd7c[51]](function(_0x97f2x32){return Contact[_0xcd7c[78]]({where:{email:msg[_0xcd7c[38]][0][_0xcd7c[37]]},defaults:{email:msg[_0xcd7c[38]][0][_0xcd7c[37]],firstName:msg[_0xcd7c[38]][0][_0xcd7c[36]]|| msg[_0xcd7c[38]][0][_0xcd7c[37]][_0xcd7c[77]](_0xcd7c[76])[0],ListId:_0x97f2x1d[_0xcd7c[75]],CompanyId:_0x97f2x32?_0x97f2x32[_0xcd7c[33]]:null}})})}else {return []}})[_0xcd7c[74]](function(_0x97f2x30){_0x97f2x1e= _0x97f2x30;return Room[_0xcd7c[61]]({mailIn:1,account:_0x97f2x1d[_0xcd7c[36]],subject:msg[_0xcd7c[35]],from:_[_0xcd7c[40]](msg[_0xcd7c[38]],_0xcd7c[37])[_0xcd7c[59]](_0xcd7c[84]),status:_0xcd7c[88],lastEvent:_0xcd7c[66],lastEventAt:moment()[_0xcd7c[34]](_0xcd7c[85]),arrivedAt:moment()[_0xcd7c[34]](_0xcd7c[85]),attachment:msg[_0xcd7c[43]]&& msg[_0xcd7c[43]][_0xcd7c[44]],MailMessages:[{messageId:msg[_0xcd7c[65]],subject:msg[_0xcd7c[35]],from:_[_0xcd7c[40]](msg[_0xcd7c[38]],_0xcd7c[37]),fromId:_0x97f2x1e?_0x97f2x1e[_0xcd7c[33]]:null,to:msg[_0xcd7c[67]]?_[_0xcd7c[40]](msg[_0xcd7c[67]],_0xcd7c[37]):[],cc:msg[_0xcd7c[39]]?_[_0xcd7c[40]](msg[_0xcd7c[39]],_0xcd7c[37]):[],bcc:msg[_0xcd7c[68]]?_[_0xcd7c[40]](msg[_0xcd7c[68]],_0xcd7c[37]):[],status:_0xcd7c[66],text:msg[_0xcd7c[69]]|| null,accountName:_0x97f2x1d[_0xcd7c[36]],accountId:_0x97f2x1d[_0xcd7c[33]]}],MailAccountId:msg[_0xcd7c[80]]},{include:[{model:Message}]})})[_0xcd7c[51]](function(_0x97f2x33){var _0x97f2x26=[];var _0x97f2x34=_0x97f2x33;var _0x97f2x28= new Scheduler({channel:_0xcd7c[30],uniqueid:util[_0xcd7c[34]](_0xcd7c[31],moment()[_0xcd7c[32]](),_0x97f2x34[_0xcd7c[33]]),subject:msg[_0xcd7c[35]],messageid:_0x97f2x34[_0xcd7c[87]][0][_0xcd7c[33]],roomid:_0x97f2x34[_0xcd7c[33]],accountid:_0x97f2x1d[_0xcd7c[33]],accountname:_0x97f2x1d[_0xcd7c[36]],accountaddress:_0x97f2x1d[_0xcd7c[37]],from:msg[_0xcd7c[38]][0][_0xcd7c[37]],cc:msg[_0xcd7c[39]]?_[_0xcd7c[40]](msg[_0xcd7c[39]],_0xcd7c[37]):[]},_0x97f2x34[_0xcd7c[87]][0][_0xcd7c[41]]);_0x97f2x28[_0xcd7c[42]]();if(msg[_0xcd7c[43]]&& msg[_0xcd7c[43]][_0xcd7c[44]]){msg[_0xcd7c[43]][_0xcd7c[63]](function(_0x97f2x29){var _0x97f2x2a=_0xcd7c[45]+ Math[_0xcd7c[46]](32);var _0x97f2x2b;_0x97f2x26[_0xcd7c[62]](Attachment[_0xcd7c[61]]({name:_0x97f2x29[_0xcd7c[48]],basename:_0x97f2x2a,path:path[_0xcd7c[59]](config[_0xcd7c[55]],_0xcd7c[56],_0xcd7c[57],_0xcd7c[43],_0xcd7c[58],_0x97f2x2a),type:_0x97f2x29[_0xcd7c[60]],size:_0x97f2x29[_0xcd7c[44]],MailMessageId:_0x97f2x34[_0xcd7c[87]][0][_0xcd7c[33]]})[_0xcd7c[51]](function(_0x97f2x2d){return open(_0x97f2x2d[_0xcd7c[3]],_0xcd7c[54])})[_0xcd7c[51]](function(_0x97f2x2c){_0x97f2x2b= _0x97f2x2c;return write(_0x97f2x2b, new Buffer(_0x97f2x29[_0xcd7c[53]][_0xcd7c[52]]),0,_0x97f2x29[_0xcd7c[44]])})[_0xcd7c[51]](function(){return close(_0x97f2x2b)})[_0xcd7c[51]](function(){console[_0xcd7c[50]](_0xcd7c[47],_0x97f2x29[_0xcd7c[48]],_0xcd7c[49])})[_0xcd7c[29]](function(_0x97f2x24){console[_0xcd7c[28]](_0x97f2x24)}))})};return Promise[_0xcd7c[64]](_0x97f2x26)})[_0xcd7c[29]](function(_0x97f2x24){console[_0xcd7c[28]](_0x97f2x24)})}}function handleState(_0x97f2x36,_0x97f2x37){return ms[_0xcd7c[81]](_0x97f2x36)[_0xcd7c[51]](function(_0x97f2x38){return _0x97f2x38[_0xcd7c[71]]({state:_0x97f2x37[_0xcd7c[89]],source:_0x97f2x37[_0xcd7c[90]]|| null})})[_0xcd7c[29]](function(_0x97f2x24){console[_0xcd7c[28]](_0x97f2x24)})}function fork(_0x97f2x36,_0x97f2x3a){return cp[_0xcd7c[97]](__dirname+ _0xcd7c[96],[_0x97f2x36,_0x97f2x3a])[_0xcd7c[91]](_0xcd7c[93],function(_0x97f2x37){switch(_0x97f2x37[_0xcd7c[95]]){case _0xcd7c[94]:handleMessage(_0x97f2x37);break;case _0xcd7c[89]:handleState(_0x97f2x36,_0x97f2x37);break;default:}})[_0xcd7c[91]](_0xcd7c[22],function(_0x97f2x3b){console[_0xcd7c[50]](util[_0xcd7c[34]](_0xcd7c[92],_0x97f2x3a,_0x97f2x3b))})[_0xcd7c[91]](_0xcd7c[28],function(_0x97f2x24){console[_0xcd7c[28]](_0x97f2x24)})}function execRequest(_0x97f2x3d,_0x97f2x3e,_0x97f2x3f){Util[_0xcd7c[100]](_0x97f2x3d,_0x97f2x3e,_0x97f2x3f)[_0xcd7c[51]](function(_0x97f2x40){console[_0xcd7c[50]](_0xcd7c[99])})[_0xcd7c[29]](function(_0x97f2x24){console[_0xcd7c[50]](_0xcd7c[98])})}function webhook(_0x97f2x3d,_0x97f2x42,_0x97f2x43){var _0x97f2x44=_0x97f2x42;switch(_0x97f2x43){case _0xcd7c[108]:if(_0x97f2x44[_0xcd7c[101]]&& _0x97f2x44[_0xcd7c[102]]){console[_0xcd7c[50]](_0xcd7c[103]+ _0x97f2x44[_0xcd7c[36]]+ _0xcd7c[104]);execRequest(_0x97f2x3d[_0xcd7c[41]],_0x97f2x44[_0xcd7c[101]],_0x97f2x44[_0xcd7c[102]])};if(_0x97f2x44[_0xcd7c[105]][_0xcd7c[44]]){_[_0xcd7c[63]](_0x97f2x44[_0xcd7c[105]],function(_0x97f2x45){if(_0x97f2x45[_0xcd7c[106]]){Util[_0xcd7c[107]](_0x97f2x45,_0x97f2x3d)}})};break;case _0xcd7c[112]:if(_0x97f2x44[_0xcd7c[109]]&& _0x97f2x44[_0xcd7c[110]]){console[_0xcd7c[50]](_0xcd7c[103]+ _0x97f2x44[_0xcd7c[36]]+ _0xcd7c[111]);execRequest(_0x97f2x3d[_0xcd7c[41]],_0x97f2x44[_0xcd7c[109]],_0x97f2x44[_0xcd7c[110]])};break;case _0xcd7c[22]:if(_0x97f2x44[_0xcd7c[113]]&& _0x97f2x44[_0xcd7c[114]]){console[_0xcd7c[50]](_0xcd7c[103]+ _0x97f2x44[_0xcd7c[36]]+ _0xcd7c[115]);execRequest(_0x97f2x3d[_0xcd7c[41]],_0x97f2x44[_0xcd7c[113]],_0x97f2x44[_0xcd7c[114]])};break;default:console[_0xcd7c[50]](_0xcd7c[116])}}function synch(mailaccounts){Account[_0xcd7c[119]](function(_0x97f2x3d){console[_0xcd7c[50]](_0xcd7c[117]+ _0x97f2x3d[_0xcd7c[36]]+ _0xcd7c[118]);mailaccounts[_0xcd7c[62]](_0x97f2x3d)});Account[_0xcd7c[124]](function(_0x97f2x3d){var _0x97f2x47=_[_0xcd7c[120]](mailaccounts,{id:_0x97f2x3d[_0xcd7c[33]]});if(_0x97f2x47){console[_0xcd7c[50]](_0xcd7c[117]+ _0x97f2x47[_0xcd7c[36]]+ _0xcd7c[121]);_[_0xcd7c[122]](_0x97f2x47,_0x97f2x3d)}else {mailaccounts[_0xcd7c[123]](_0x97f2x3d)}});Account[_0xcd7c[126]](function(_0x97f2x3d){_[_0xcd7c[125]](mailaccounts,{id:_0x97f2x3d[_0xcd7c[33]]})})}module[_0xcd7c[127]]= function(){var _0x97f2x48={};var _0x97f2x49;process[_0xcd7c[91]](_0xcd7c[128],function(_0x97f2x3b){for(var _0x97f2x4a in _0x97f2x48){if(_0x97f2x48[_0x97f2x4a]){_0x97f2x48[_0x97f2x4a][_0xcd7c[129]]()}}});Account[_0xcd7c[135]]()[_0xcd7c[51]](function(_0x97f2x4b){mailaccounts= _0x97f2x4b;synch(mailaccounts);ReportMail[_0xcd7c[124]](function(_0x97f2x3d){var _0x97f2x42=_[_0xcd7c[120]](mailaccounts,{id:parseInt(_0x97f2x3d[_0xcd7c[130]])});if(_0x97f2x42&& _0x97f2x3d[_0xcd7c[132]](_0xcd7c[131])){webhook(_0x97f2x3d,_0x97f2x42,_0xcd7c[108])};if(_0x97f2x42&& _0x97f2x3d[_0xcd7c[132]](_0xcd7c[133])){webhook(_0x97f2x3d,_0x97f2x42,_0xcd7c[112])}});Room[_0xcd7c[124]](function(_0x97f2x3d){var _0x97f2x42=_[_0xcd7c[120]](mailaccounts,{id:_0x97f2x3d[_0xcd7c[134]]});if(_0x97f2x42&& _0x97f2x3d[_0xcd7c[132]](_0xcd7c[72])&& _0x97f2x3d[_0xcd7c[72]]=== _0xcd7c[73]){webhook(_0x97f2x3d,_0x97f2x42,_0xcd7c[22])}})})[_0xcd7c[29]](function(_0x97f2x24){console[_0xcd7c[28]](_0x97f2x24)});ms[_0xcd7c[119]](function(_0x97f2x38){_0x97f2x48[_0x97f2x38[_0xcd7c[33]]]= fork(_0x97f2x38[_0xcd7c[33]],_0x97f2x38[_0xcd7c[136]])});ms[_0xcd7c[124]](function(_0x97f2x38){if(_0x97f2x48[_0x97f2x38[_0xcd7c[33]]]){if(_0x97f2x38[_0xcd7c[132]](_0xcd7c[89])|| _0x97f2x38[_0xcd7c[132]](_0xcd7c[90])){console[_0xcd7c[50]](util[_0xcd7c[34]](_0xcd7c[137],_0x97f2x38[_0xcd7c[33]],_0x97f2x48[_0x97f2x38[_0xcd7c[33]]][_0xcd7c[138]]));clearTimeout(_0x97f2x49);switch(_0x97f2x38[_0xcd7c[89]]){case _0xcd7c[139]:_0x97f2x49= setTimeout(function(){_0x97f2x48[_0x97f2x38[_0xcd7c[33]]]= fork(_0x97f2x38[_0xcd7c[33]],_0x97f2x38[_0xcd7c[136]])},10000);break;default:}}else {_0x97f2x48[_0x97f2x38[_0xcd7c[33]]][_0xcd7c[129]]();_0x97f2x48[_0x97f2x38[_0xcd7c[33]]]= null;_0x97f2x48[_0x97f2x38[_0xcd7c[33]]]= fork(_0x97f2x38[_0xcd7c[33]],_0x97f2x38[_0xcd7c[136]])}}});ms[_0xcd7c[126]](function(_0x97f2x38){if(_0x97f2x48[_0x97f2x38[_0xcd7c[33]]]){console[_0xcd7c[50]](util[_0xcd7c[34]](_0xcd7c[140],_0x97f2x38[_0xcd7c[33]],_0x97f2x48[_0x97f2x38[_0xcd7c[33]]][_0xcd7c[138]]));_0x97f2x48[_0x97f2x38[_0xcd7c[33]]][_0xcd7c[129]]();_0x97f2x48[_0x97f2x38[_0xcd7c[33]]]= null}});ms[_0xcd7c[135]]()[_0xcd7c[51]](function(_0x97f2x4c){_0x97f2x4c[_0xcd7c[63]](function(_0x97f2x38){_0x97f2x48[_0x97f2x38[_0xcd7c[33]]]= fork(_0x97f2x38[_0xcd7c[33]],_0x97f2x38[_0xcd7c[136]])})})[_0xcd7c[29]](function(_0x97f2x24){console[_0xcd7c[28]](_0x97f2x24)})}