Built motion from commit fa8c70b.|0.0.144
[motion.git] / server / config / imap / index.js
index 79dafcf..cb818ef 100644 (file)
@@ -1 +1 @@
-var _0xc7ae=["\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","\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","\x63\x6F\x6E\x6E\x65\x63\x74\x69\x64","\x63\x68\x61\x6E\x67\x65\x64","\x65\x72\x72","\x4D\x61\x69\x6C\x20\x61\x63\x63\x6F\x75\x6E\x74\x20\x6E\x6F\x74\x20\x66\x6F\x75\x6E\x64","\x61\x63\x63\x65\x70\x74\x4D\x65\x74\x68\x6F\x64","\x61\x63\x63\x65\x70\x74\x55\x72\x6C","\x64\x61\x74\x61\x56\x61\x6C\x75\x65\x73","\x4D\x61\x69\x6C\x20\x41\x63\x63\x6F\x75\x6E\x74\x20\x48\x54\x54\x50\x20\x4D\x65\x74\x68\x6F\x64\x20\x6F\x72\x20\x55\x52\x4C\x20\x69\x73\x20\x6E\x6F\x74\x20\x63\x6F\x6E\x66\x69\x67\x75\x72\x65\x64\x2E\x20\x43\x6F\x6E\x74\x61\x63\x74\x20\x79\x6F\x75\x72\x20\x61\x64\x6D\x69\x6E\x69\x73\x74\x72\x61\x74\x6F\x72\x21\x21","\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\x6F\x75\x6E\x74\x69\x64","\x72\x65\x6A\x65\x63\x74\x65\x64\x41\x74","\x46\x61\x78\x20\x61\x63\x63\x6F\x75\x6E\x74\x20\x6E\x6F\x74\x20\x66\x6F\x75\x6E\x64","\x72\x65\x6A\x65\x63\x74\x4D\x65\x74\x68\x6F\x64","\x72\x65\x6A\x65\x63\x74\x55\x72\x6C","\x65\x78\x70\x6F\x72\x74\x73","\x65\x78\x69\x74","\x6B\x69\x6C\x6C","\x61\x66\x74\x65\x72\x55\x70\x64\x61\x74\x65","\x75\x73\x65\x72\x6E\x61\x6D\x65","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\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","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x66\x69\x6E\x64\x41\x6C\x6C"];_0xc7ae[0];const _=require(_0xc7ae[1]);const util=require(_0xc7ae[2]);const path=require(_0xc7ae[3]);const cp=require(_0xc7ae[4]);const ms=require(_0xc7ae[6])[_0xc7ae[5]];const msg=require(_0xc7ae[6])[_0xc7ae[7]];const Room=require(_0xc7ae[6])[_0xc7ae[8]];const Status=require(_0xc7ae[6])[_0xc7ae[9]];const Message=require(_0xc7ae[6])[_0xc7ae[7]];const Account=require(_0xc7ae[6])[_0xc7ae[10]];const Contact=require(_0xc7ae[6])[_0xc7ae[11]];const Company=require(_0xc7ae[6])[_0xc7ae[12]];const Attachment=require(_0xc7ae[6])[_0xc7ae[13]];const ReportMail=require(_0xc7ae[6])[_0xc7ae[14]];const ReportMailRoom=require(_0xc7ae[6])[_0xc7ae[15]];const ReportMailSession=require(_0xc7ae[6])[_0xc7ae[16]];const Promise=require(_0xc7ae[17]);const moment=require(_0xc7ae[18]);const open=Promise[_0xc7ae[21]](require(_0xc7ae[20])[_0xc7ae[19]]);const close=Promise[_0xc7ae[21]](require(_0xc7ae[20])[_0xc7ae[22]]);const write=Promise[_0xc7ae[21]](require(_0xc7ae[20])[_0xc7ae[23]]);const config=require(_0xc7ae[24]);var Scheduler=require(_0xc7ae[25]);var Util=require(_0xc7ae[26]);function handleMessage(msg){var _0xbe79x1a;var _0xbe79x1b;var _0xbe79x1c;var _0xbe79x1d;var _0xbe79x1e;var _0xbe79x1f,_0xbe79x20,_0xbe79x21,_0xbe79x22;if(msg[_0xc7ae[27]]){return Message[_0xc7ae[78]]({where:{messageId:msg[_0xc7ae[27]][0]}})[_0xc7ae[50]](function(_0xbe79x2e){if(_0xbe79x2e){return _0xbe79x2e[_0xc7ae[85]]()[_0xc7ae[50]](function(_0xbe79x2d){_0xbe79x1a= _0xbe79x2d;if(_0xbe79x2d[_0xc7ae[71]]!== _0xc7ae[72]){return _0xbe79x1a[_0xc7ae[70]]({status:_0xc7ae[81],openReason:_0xc7ae[82]},{individualHooks:true})[_0xc7ae[50]](function(){return Account[_0xc7ae[80]](msg[_0xc7ae[79]])[_0xc7ae[50]](function(_0xbe79x30){_0xbe79x1c= _0xbe79x30;if(_0xbe79x1c[_0xc7ae[74]]){return Company[_0xc7ae[78]]({where:{emailDomain:msg[_0xc7ae[38]][0][_0xc7ae[37]][_0xc7ae[76]](_0xc7ae[75])[1]}})[_0xc7ae[50]](function(_0xbe79x31){return Contact[_0xc7ae[77]]({where:{email:msg[_0xc7ae[38]][0][_0xc7ae[37]]},defaults:{email:msg[_0xc7ae[38]][0][_0xc7ae[37]],firstName:msg[_0xc7ae[38]][0][_0xc7ae[36]]|| msg[_0xc7ae[38]][0][_0xc7ae[37]][_0xc7ae[76]](_0xc7ae[75])[0],ListId:_0xbe79x1c[_0xc7ae[74]],CompanyId:_0xbe79x31?_0xbe79x31[_0xc7ae[33]]:null}})})}else {return []}})[_0xc7ae[73]](function(_0xbe79x2f){_0xbe79x1d= _0xbe79x2f})})}else {return Account[_0xc7ae[80]](msg[_0xc7ae[79]])[_0xc7ae[50]](function(_0xbe79x30){_0xbe79x1c= _0xbe79x30;if(_0xbe79x1c[_0xc7ae[74]]){return Company[_0xc7ae[78]]({where:{emailDomain:msg[_0xc7ae[38]][0][_0xc7ae[37]][_0xc7ae[76]](_0xc7ae[75])[1]}})[_0xc7ae[50]](function(_0xbe79x31){return Contact[_0xc7ae[77]]({where:{email:msg[_0xc7ae[38]][0][_0xc7ae[37]]},defaults:{email:msg[_0xc7ae[38]][0][_0xc7ae[37]],firstName:msg[_0xc7ae[38]][0][_0xc7ae[36]]|| msg[_0xc7ae[38]][0][_0xc7ae[37]][_0xc7ae[76]](_0xc7ae[75])[0],ListId:_0xbe79x1c[_0xc7ae[74]],CompanyId:_0xbe79x31?_0xbe79x31[_0xc7ae[33]]:null}})})}else {return []}})[_0xc7ae[73]](function(_0xbe79x2f){_0xbe79x1d= _0xbe79x2f;return Room[_0xc7ae[60]]({subject:msg[_0xc7ae[35]],from:_[_0xc7ae[40]](msg[_0xc7ae[38]],_0xc7ae[37])[_0xc7ae[58]](_0xc7ae[83]),account:_0xbe79x1c[_0xc7ae[36]],attachment:msg[_0xc7ae[42]]&& msg[_0xc7ae[42]][_0xc7ae[43]],lastEvent:_0xc7ae[65],lastEventAt:moment()[_0xc7ae[34]](_0xc7ae[84]),arrivedAt:moment()[_0xc7ae[34]](_0xc7ae[84]),MailAccountId:_0xbe79x1c[_0xc7ae[33]],ParentId:_0xbe79x2d[_0xc7ae[33]]})})[_0xc7ae[50]](function(_0xbe79x2d){_0xbe79x1a= _0xbe79x2d})}})}else {return Account[_0xc7ae[80]](msg[_0xc7ae[79]])[_0xc7ae[50]](function(_0xbe79x30){_0xbe79x1c= _0xbe79x30;if(_0xbe79x1c[_0xc7ae[74]]){return Company[_0xc7ae[78]]({where:{emailDomain:msg[_0xc7ae[38]][0][_0xc7ae[37]][_0xc7ae[76]](_0xc7ae[75])[1]}})[_0xc7ae[50]](function(_0xbe79x31){return Contact[_0xc7ae[77]]({where:{email:msg[_0xc7ae[38]][0][_0xc7ae[37]]},defaults:{email:msg[_0xc7ae[38]][0][_0xc7ae[37]],firstName:msg[_0xc7ae[38]][0][_0xc7ae[36]]|| msg[_0xc7ae[38]][0][_0xc7ae[37]][_0xc7ae[76]](_0xc7ae[75])[0],ListId:_0xbe79x1c[_0xc7ae[74]],CompanyId:_0xbe79x31?_0xbe79x31[_0xc7ae[33]]:null}})})}else {return []}})[_0xc7ae[73]](function(_0xbe79x2f){_0xbe79x1d= _0xbe79x2f;return Room[_0xc7ae[60]]({subject:msg[_0xc7ae[35]],from:_[_0xc7ae[40]](msg[_0xc7ae[38]],_0xc7ae[37])[_0xc7ae[58]](_0xc7ae[83]),account:_0xbe79x1c[_0xc7ae[36]],attachment:msg[_0xc7ae[42]]&& msg[_0xc7ae[42]][_0xc7ae[43]],lastEvent:_0xc7ae[65],lastEventAt:moment()[_0xc7ae[34]](_0xc7ae[84]),arrivedAt:moment()[_0xc7ae[34]](_0xc7ae[84]),MailAccountId:_0xbe79x1c[_0xc7ae[33]]})})[_0xc7ae[50]](function(_0xbe79x2d){_0xbe79x1a= _0xbe79x2d})}})[_0xc7ae[50]](function(){return _0xbe79x1a[_0xc7ae[70]]({lastEvent:_0xc7ae[65],mailIn:++_0xbe79x1a[_0xc7ae[69]]})})[_0xc7ae[50]](function(_0xbe79x2d){return Message[_0xc7ae[60]]({fromId:_0xbe79x1d?_0xbe79x1d[_0xc7ae[33]]:null,messageId:msg[_0xc7ae[64]],status:_0xc7ae[65],subject:msg[_0xc7ae[35]],from:_[_0xc7ae[40]](msg[_0xc7ae[38]],_0xc7ae[37]),to:msg[_0xc7ae[66]]?_[_0xc7ae[40]](msg[_0xc7ae[66]],_0xc7ae[37]):[],cc:msg[_0xc7ae[39]]?_[_0xc7ae[40]](msg[_0xc7ae[39]],_0xc7ae[37]):[],bcc:msg[_0xc7ae[67]]?_[_0xc7ae[40]](msg[_0xc7ae[67]],_0xc7ae[37]):[],text:msg[_0xc7ae[68]]|| null,MailRoomId:_0xbe79x1a[_0xc7ae[33]]})})[_0xc7ae[50]](function(_0xbe79x24){var _0xbe79x25=[];var _0xbe79x26=_0xbe79x24;var _0xbe79x27= new Scheduler({channel:_0xc7ae[30],uniqueid:util[_0xc7ae[34]](_0xc7ae[31],moment()[_0xc7ae[32]](),_0xbe79x1a[_0xc7ae[33]]),subject:msg[_0xc7ae[35]],messageid:_0xbe79x26[_0xc7ae[33]],roomid:_0xbe79x1a[_0xc7ae[33]],accountid:_0xbe79x1c[_0xc7ae[33]],accountname:_0xbe79x1c[_0xc7ae[36]],accountaddress:_0xbe79x1c[_0xc7ae[37]],from:msg[_0xc7ae[38]][0][_0xc7ae[37]],cc:msg[_0xc7ae[39]]?_[_0xc7ae[40]](msg[_0xc7ae[39]],_0xc7ae[37]):[]});_0xbe79x27[_0xc7ae[41]]();if(msg[_0xc7ae[42]]&& msg[_0xc7ae[42]][_0xc7ae[43]]){msg[_0xc7ae[42]][_0xc7ae[62]](function(_0xbe79x28){var _0xbe79x29=_0xc7ae[44]+ Math[_0xc7ae[45]](32);var _0xbe79x2a;_0xbe79x25[_0xc7ae[61]](Attachment[_0xc7ae[60]]({name:_0xbe79x28[_0xc7ae[47]],basename:_0xbe79x29,path:path[_0xc7ae[58]](config[_0xc7ae[54]],_0xc7ae[55],_0xc7ae[56],_0xc7ae[42],_0xc7ae[57],_0xbe79x29),type:_0xbe79x28[_0xc7ae[59]],size:_0xbe79x28[_0xc7ae[43]],MailMessageId:_0xbe79x26[_0xc7ae[33]]})[_0xc7ae[50]](function(_0xbe79x2c){return open(_0xbe79x2c[_0xc7ae[3]],_0xc7ae[53])})[_0xc7ae[50]](function(_0xbe79x2b){_0xbe79x2a= _0xbe79x2b;return write(_0xbe79x2a, new Buffer(_0xbe79x28[_0xc7ae[52]][_0xc7ae[51]]),0,_0xbe79x28[_0xc7ae[43]])})[_0xc7ae[50]](function(){return close(_0xbe79x2a)})[_0xc7ae[50]](function(){console[_0xc7ae[49]](_0xc7ae[46],_0xbe79x28[_0xc7ae[47]],_0xc7ae[48])})[_0xc7ae[29]](function(_0xbe79x23){console[_0xc7ae[28]](_0xbe79x23)}))})};return Promise[_0xc7ae[63]](_0xbe79x25)})[_0xc7ae[29]](function(_0xbe79x23){console[_0xc7ae[28]](_0xbe79x23)})}else {return Account[_0xc7ae[80]](msg[_0xc7ae[79]])[_0xc7ae[50]](function(_0xbe79x30){_0xbe79x1c= _0xbe79x30;if(_0xbe79x1c[_0xc7ae[74]]){return Company[_0xc7ae[78]]({where:{emailDomain:msg[_0xc7ae[38]][0][_0xc7ae[37]][_0xc7ae[76]](_0xc7ae[75])[1]}})[_0xc7ae[50]](function(_0xbe79x31){return Contact[_0xc7ae[77]]({where:{email:msg[_0xc7ae[38]][0][_0xc7ae[37]]},defaults:{email:msg[_0xc7ae[38]][0][_0xc7ae[37]],firstName:msg[_0xc7ae[38]][0][_0xc7ae[36]]|| msg[_0xc7ae[38]][0][_0xc7ae[37]][_0xc7ae[76]](_0xc7ae[75])[0],ListId:_0xbe79x1c[_0xc7ae[74]],CompanyId:_0xbe79x31?_0xbe79x31[_0xc7ae[33]]:null}})})}else {return []}})[_0xc7ae[73]](function(_0xbe79x2f){_0xbe79x1d= _0xbe79x2f;return Room[_0xc7ae[60]]({mailIn:1,account:_0xbe79x1c[_0xc7ae[36]],subject:msg[_0xc7ae[35]],from:_[_0xc7ae[40]](msg[_0xc7ae[38]],_0xc7ae[37])[_0xc7ae[58]](_0xc7ae[83]),status:_0xc7ae[87],lastEvent:_0xc7ae[65],lastEventAt:moment()[_0xc7ae[34]](_0xc7ae[84]),arrivedAt:moment()[_0xc7ae[34]](_0xc7ae[84]),attachment:msg[_0xc7ae[42]]&& msg[_0xc7ae[42]][_0xc7ae[43]],MailMessages:[{messageId:msg[_0xc7ae[64]],subject:msg[_0xc7ae[35]],from:_[_0xc7ae[40]](msg[_0xc7ae[38]],_0xc7ae[37]),fromId:_0xbe79x1d?_0xbe79x1d[_0xc7ae[33]]:null,to:msg[_0xc7ae[66]]?_[_0xc7ae[40]](msg[_0xc7ae[66]],_0xc7ae[37]):[],cc:msg[_0xc7ae[39]]?_[_0xc7ae[40]](msg[_0xc7ae[39]],_0xc7ae[37]):[],bcc:msg[_0xc7ae[67]]?_[_0xc7ae[40]](msg[_0xc7ae[67]],_0xc7ae[37]):[],status:_0xc7ae[65],text:msg[_0xc7ae[68]]|| null}],MailAccountId:msg[_0xc7ae[79]]},{include:[{model:Message}]})})[_0xc7ae[50]](function(_0xbe79x32){var _0xbe79x25=[];var _0xbe79x33=_0xbe79x32;var _0xbe79x27= new Scheduler({channel:_0xc7ae[30],uniqueid:util[_0xc7ae[34]](_0xc7ae[31],moment()[_0xc7ae[32]](),_0xbe79x33[_0xc7ae[33]]),subject:msg[_0xc7ae[35]],messageid:_0xbe79x33[_0xc7ae[86]][0][_0xc7ae[33]],roomid:_0xbe79x33[_0xc7ae[33]],accountid:_0xbe79x1c[_0xc7ae[33]],accountname:_0xbe79x1c[_0xc7ae[36]],accountaddress:_0xbe79x1c[_0xc7ae[37]],from:msg[_0xc7ae[38]][0][_0xc7ae[37]],cc:msg[_0xc7ae[39]]?_[_0xc7ae[40]](msg[_0xc7ae[39]],_0xc7ae[37]):[]});_0xbe79x27[_0xc7ae[41]]();if(msg[_0xc7ae[42]]&& msg[_0xc7ae[42]][_0xc7ae[43]]){msg[_0xc7ae[42]][_0xc7ae[62]](function(_0xbe79x28){var _0xbe79x29=_0xc7ae[44]+ Math[_0xc7ae[45]](32);var _0xbe79x2a;_0xbe79x25[_0xc7ae[61]](Attachment[_0xc7ae[60]]({name:_0xbe79x28[_0xc7ae[47]],basename:_0xbe79x29,path:path[_0xc7ae[58]](config[_0xc7ae[54]],_0xc7ae[55],_0xc7ae[56],_0xc7ae[42],_0xc7ae[57],_0xbe79x29),type:_0xbe79x28[_0xc7ae[59]],size:_0xbe79x28[_0xc7ae[43]],MailMessageId:_0xbe79x33[_0xc7ae[86]][0][_0xc7ae[33]]})[_0xc7ae[50]](function(_0xbe79x2c){return open(_0xbe79x2c[_0xc7ae[3]],_0xc7ae[53])})[_0xc7ae[50]](function(_0xbe79x2b){_0xbe79x2a= _0xbe79x2b;return write(_0xbe79x2a, new Buffer(_0xbe79x28[_0xc7ae[52]][_0xc7ae[51]]),0,_0xbe79x28[_0xc7ae[43]])})[_0xc7ae[50]](function(){return close(_0xbe79x2a)})[_0xc7ae[50]](function(){console[_0xc7ae[49]](_0xc7ae[46],_0xbe79x28[_0xc7ae[47]],_0xc7ae[48])})[_0xc7ae[29]](function(_0xbe79x23){console[_0xc7ae[28]](_0xbe79x23)}))})};return Promise[_0xc7ae[63]](_0xbe79x25)})[_0xc7ae[29]](function(_0xbe79x23){console[_0xc7ae[28]](_0xbe79x23)})}}function handleState(_0xbe79x35,_0xbe79x36){return ms[_0xc7ae[80]](_0xbe79x35)[_0xc7ae[50]](function(_0xbe79x37){return _0xbe79x37[_0xc7ae[70]]({state:_0xbe79x36[_0xc7ae[88]],source:_0xbe79x36[_0xc7ae[89]]|| null})})[_0xc7ae[29]](function(_0xbe79x23){console[_0xc7ae[28]](_0xbe79x23)})}function fork(_0xbe79x35,_0xbe79x39){return cp[_0xc7ae[96]](__dirname+ _0xc7ae[95],[_0xbe79x35,_0xbe79x39])[_0xc7ae[90]](_0xc7ae[92],function(_0xbe79x36){switch(_0xbe79x36[_0xc7ae[94]]){case _0xc7ae[93]:handleMessage(_0xbe79x36);break;case _0xc7ae[88]:handleState(_0xbe79x35,_0xbe79x36);break;default:}})[_0xc7ae[90]](_0xc7ae[22],function(_0xbe79x3a){console[_0xc7ae[49]](util[_0xc7ae[34]](_0xc7ae[91],_0xbe79x39,_0xbe79x3a))})[_0xc7ae[90]](_0xc7ae[28],function(_0xbe79x23){console[_0xc7ae[28]](_0xbe79x23)})}function execRequest(_0xbe79x3c,_0xbe79x3d,_0xbe79x3e){Util[_0xc7ae[99]](_0xbe79x3c,_0xbe79x3d,_0xbe79x3e)[_0xc7ae[50]](function(_0xbe79x3f){console[_0xc7ae[49]](_0xc7ae[98])})[_0xc7ae[29]](function(_0xbe79x23){console[_0xc7ae[49]](_0xc7ae[97])})}function onReportUpdate(_0xbe79x3c){var _0xbe79x41;if(_0xbe79x3c[_0xc7ae[101]](_0xc7ae[100])){return Account[_0xc7ae[80]](parseInt(_0xbe79x3c[_0xc7ae[111]]))[_0xc7ae[50]](function(_0xbe79x30){if(!_0xbe79x30){throw  new Error(_0xc7ae[103])};_0xbe79x41= _0xbe79x30;if(_0xbe79x41[_0xc7ae[104]]&& _0xbe79x41[_0xc7ae[105]]){execRequest(_0xbe79x3c[_0xc7ae[106]],_0xbe79x41[_0xc7ae[104]],_0xbe79x41[_0xc7ae[105]])}else {throw  new Error(_0xc7ae[107])};if(_0xbe79x41[_0xc7ae[108]][_0xc7ae[43]]){_[_0xc7ae[62]](_0xbe79x41[_0xc7ae[108]],function(_0xbe79x42){if(_0xbe79x42[_0xc7ae[109]]){Util[_0xc7ae[110]](_0xbe79x42,_0xbe79x3c)}})}})[_0xc7ae[29]](function(_0xbe79x23){console[_0xc7ae[49]](_0xc7ae[102],_0xbe79x23)})};if(_0xbe79x3c[_0xc7ae[101]](_0xc7ae[112])){return Account[_0xc7ae[80]](_0xbe79x3c[_0xc7ae[111]])[_0xc7ae[50]](function(_0xbe79x30){if(!_0xbe79x30){throw  new Error(_0xc7ae[113])};_0xbe79x41= _0xbe79x30;if(_0xbe79x41[_0xc7ae[114]]&& _0xbe79x41[_0xc7ae[115]]){execRequest(_0xbe79x3c[_0xc7ae[106]],_0xbe79x41[_0xc7ae[114]],_0xbe79x41[_0xc7ae[115]])}})[_0xc7ae[29]](function(_0xbe79x23){console[_0xc7ae[49]](_0xc7ae[102],_0xbe79x23)})}}module[_0xc7ae[116]]= function(){var _0xbe79x43={};var _0xbe79x44;process[_0xc7ae[90]](_0xc7ae[117],function(_0xbe79x3a){for(var _0xbe79x45 in _0xbe79x43){if(_0xbe79x43[_0xbe79x45]){_0xbe79x43[_0xbe79x45][_0xc7ae[118]]()}}});ReportMail[_0xc7ae[119]](function(_0xbe79x3c){onReportUpdate(_0xbe79x3c)});ms[_0xc7ae[121]](function(_0xbe79x37){_0xbe79x43[_0xbe79x37[_0xc7ae[33]]]= fork(_0xbe79x37[_0xc7ae[33]],_0xbe79x37[_0xc7ae[120]])});ms[_0xc7ae[119]](function(_0xbe79x37){if(_0xbe79x43[_0xbe79x37[_0xc7ae[33]]]){if(_0xbe79x37[_0xc7ae[101]](_0xc7ae[88])|| _0xbe79x37[_0xc7ae[101]](_0xc7ae[89])){console[_0xc7ae[49]](util[_0xc7ae[34]](_0xc7ae[122],_0xbe79x37[_0xc7ae[33]],_0xbe79x43[_0xbe79x37[_0xc7ae[33]]][_0xc7ae[123]]));clearTimeout(_0xbe79x44);switch(_0xbe79x37[_0xc7ae[88]]){case _0xc7ae[124]:_0xbe79x44= setTimeout(function(){_0xbe79x43[_0xbe79x37[_0xc7ae[33]]]= fork(_0xbe79x37[_0xc7ae[33]],_0xbe79x37[_0xc7ae[120]])},10000);break;default:}}else {_0xbe79x43[_0xbe79x37[_0xc7ae[33]]][_0xc7ae[118]]();_0xbe79x43[_0xbe79x37[_0xc7ae[33]]]= null;_0xbe79x43[_0xbe79x37[_0xc7ae[33]]]= fork(_0xbe79x37[_0xc7ae[33]],_0xbe79x37[_0xc7ae[120]])}}});ms[_0xc7ae[126]](function(_0xbe79x37){if(_0xbe79x43[_0xbe79x37[_0xc7ae[33]]]){console[_0xc7ae[49]](util[_0xc7ae[34]](_0xc7ae[125],_0xbe79x37[_0xc7ae[33]],_0xbe79x43[_0xbe79x37[_0xc7ae[33]]][_0xc7ae[123]]));_0xbe79x43[_0xbe79x37[_0xc7ae[33]]][_0xc7ae[118]]();_0xbe79x43[_0xbe79x37[_0xc7ae[33]]]= null}});ms[_0xc7ae[127]]()[_0xc7ae[50]](function(_0xbe79x46){_0xbe79x46[_0xc7ae[62]](function(_0xbe79x37){_0xbe79x43[_0xbe79x37[_0xc7ae[33]]]= fork(_0xbe79x37[_0xc7ae[33]],_0xbe79x37[_0xc7ae[120]])})})[_0xc7ae[29]](function(_0xbe79x23){console[_0xc7ae[28]](_0xbe79x23)})}
\ No newline at end of file
+var _0xbd3e=["\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","\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"];_0xbd3e[0];const _=require(_0xbd3e[1]);const util=require(_0xbd3e[2]);const path=require(_0xbd3e[3]);const cp=require(_0xbd3e[4]);const ms=require(_0xbd3e[6])[_0xbd3e[5]];const msg=require(_0xbd3e[6])[_0xbd3e[7]];const Room=require(_0xbd3e[6])[_0xbd3e[8]];const Status=require(_0xbd3e[6])[_0xbd3e[9]];const Message=require(_0xbd3e[6])[_0xbd3e[7]];const Account=require(_0xbd3e[6])[_0xbd3e[10]];const Contact=require(_0xbd3e[6])[_0xbd3e[11]];const Company=require(_0xbd3e[6])[_0xbd3e[12]];const Attachment=require(_0xbd3e[6])[_0xbd3e[13]];const ReportMail=require(_0xbd3e[6])[_0xbd3e[14]];const ReportMailRoom=require(_0xbd3e[6])[_0xbd3e[15]];const ReportMailSession=require(_0xbd3e[6])[_0xbd3e[16]];const Promise=require(_0xbd3e[17]);const moment=require(_0xbd3e[18]);const open=Promise[_0xbd3e[21]](require(_0xbd3e[20])[_0xbd3e[19]]);const close=Promise[_0xbd3e[21]](require(_0xbd3e[20])[_0xbd3e[22]]);const write=Promise[_0xbd3e[21]](require(_0xbd3e[20])[_0xbd3e[23]]);const config=require(_0xbd3e[24]);var mailaccounts;var Scheduler=require(_0xbd3e[25]);var Util=require(_0xbd3e[26]);function handleMessage(msg){var _0xe841x1b;var _0xe841x1c;var _0xe841x1d;var _0xe841x1e;var _0xe841x1f;var _0xe841x20,_0xe841x21,_0xe841x22,_0xe841x23;if(msg[_0xbd3e[27]]){return Message[_0xbd3e[79]]({where:{messageId:msg[_0xbd3e[27]][0],accountId:msg[_0xbd3e[80]]}})[_0xbd3e[51]](function(_0xe841x2f){if(_0xe841x2f){return _0xe841x2f[_0xbd3e[86]]()[_0xbd3e[51]](function(_0xe841x2e){_0xe841x1b= _0xe841x2e;if(_0xe841x2e[_0xbd3e[72]]!== _0xbd3e[73]){return _0xe841x1b[_0xbd3e[71]]({status:_0xbd3e[82],openReason:_0xbd3e[83]},{individualHooks:true})[_0xbd3e[51]](function(){return Account[_0xbd3e[81]](msg[_0xbd3e[80]])[_0xbd3e[51]](function(_0xe841x31){_0xe841x1d= _0xe841x31;if(_0xe841x1d[_0xbd3e[75]]){return Company[_0xbd3e[79]]({where:{emailDomain:msg[_0xbd3e[38]][0][_0xbd3e[37]][_0xbd3e[77]](_0xbd3e[76])[1]}})[_0xbd3e[51]](function(_0xe841x32){return Contact[_0xbd3e[78]]({where:{email:msg[_0xbd3e[38]][0][_0xbd3e[37]]},defaults:{email:msg[_0xbd3e[38]][0][_0xbd3e[37]],firstName:msg[_0xbd3e[38]][0][_0xbd3e[36]]|| msg[_0xbd3e[38]][0][_0xbd3e[37]][_0xbd3e[77]](_0xbd3e[76])[0],ListId:_0xe841x1d[_0xbd3e[75]],CompanyId:_0xe841x32?_0xe841x32[_0xbd3e[33]]:null}})})}else {return []}})[_0xbd3e[74]](function(_0xe841x30){_0xe841x1e= _0xe841x30})})}else {return Account[_0xbd3e[81]](msg[_0xbd3e[80]])[_0xbd3e[51]](function(_0xe841x31){_0xe841x1d= _0xe841x31;if(_0xe841x1d[_0xbd3e[75]]){return Company[_0xbd3e[79]]({where:{emailDomain:msg[_0xbd3e[38]][0][_0xbd3e[37]][_0xbd3e[77]](_0xbd3e[76])[1]}})[_0xbd3e[51]](function(_0xe841x32){return Contact[_0xbd3e[78]]({where:{email:msg[_0xbd3e[38]][0][_0xbd3e[37]]},defaults:{email:msg[_0xbd3e[38]][0][_0xbd3e[37]],firstName:msg[_0xbd3e[38]][0][_0xbd3e[36]]|| msg[_0xbd3e[38]][0][_0xbd3e[37]][_0xbd3e[77]](_0xbd3e[76])[0],ListId:_0xe841x1d[_0xbd3e[75]],CompanyId:_0xe841x32?_0xe841x32[_0xbd3e[33]]:null}})})}else {return []}})[_0xbd3e[74]](function(_0xe841x30){_0xe841x1e= _0xe841x30;return Room[_0xbd3e[61]]({subject:msg[_0xbd3e[35]],from:_[_0xbd3e[40]](msg[_0xbd3e[38]],_0xbd3e[37])[_0xbd3e[59]](_0xbd3e[84]),account:_0xe841x1d[_0xbd3e[36]],attachment:msg[_0xbd3e[43]]&& msg[_0xbd3e[43]][_0xbd3e[44]],lastEvent:_0xbd3e[66],lastEventAt:moment()[_0xbd3e[34]](_0xbd3e[85]),arrivedAt:moment()[_0xbd3e[34]](_0xbd3e[85]),MailAccountId:_0xe841x1d[_0xbd3e[33]],ParentId:_0xe841x2e[_0xbd3e[33]]})})[_0xbd3e[51]](function(_0xe841x2e){_0xe841x1b= _0xe841x2e})}})}else {return Account[_0xbd3e[81]](msg[_0xbd3e[80]])[_0xbd3e[51]](function(_0xe841x31){_0xe841x1d= _0xe841x31;if(_0xe841x1d[_0xbd3e[75]]){return Company[_0xbd3e[79]]({where:{emailDomain:msg[_0xbd3e[38]][0][_0xbd3e[37]][_0xbd3e[77]](_0xbd3e[76])[1]}})[_0xbd3e[51]](function(_0xe841x32){return Contact[_0xbd3e[78]]({where:{email:msg[_0xbd3e[38]][0][_0xbd3e[37]]},defaults:{email:msg[_0xbd3e[38]][0][_0xbd3e[37]],firstName:msg[_0xbd3e[38]][0][_0xbd3e[36]]|| msg[_0xbd3e[38]][0][_0xbd3e[37]][_0xbd3e[77]](_0xbd3e[76])[0],ListId:_0xe841x1d[_0xbd3e[75]],CompanyId:_0xe841x32?_0xe841x32[_0xbd3e[33]]:null}})})}else {return []}})[_0xbd3e[74]](function(_0xe841x30){_0xe841x1e= _0xe841x30;return Room[_0xbd3e[61]]({subject:msg[_0xbd3e[35]],from:_[_0xbd3e[40]](msg[_0xbd3e[38]],_0xbd3e[37])[_0xbd3e[59]](_0xbd3e[84]),account:_0xe841x1d[_0xbd3e[36]],attachment:msg[_0xbd3e[43]]&& msg[_0xbd3e[43]][_0xbd3e[44]],lastEvent:_0xbd3e[66],lastEventAt:moment()[_0xbd3e[34]](_0xbd3e[85]),arrivedAt:moment()[_0xbd3e[34]](_0xbd3e[85]),MailAccountId:_0xe841x1d[_0xbd3e[33]]})})[_0xbd3e[51]](function(_0xe841x2e){_0xe841x1b= _0xe841x2e})}})[_0xbd3e[51]](function(){return _0xe841x1b[_0xbd3e[71]]({lastEvent:_0xbd3e[66],mailIn:++_0xe841x1b[_0xbd3e[70]]})})[_0xbd3e[51]](function(_0xe841x2e){return Message[_0xbd3e[61]]({fromId:_0xe841x1e?_0xe841x1e[_0xbd3e[33]]:null,messageId:msg[_0xbd3e[65]],status:_0xbd3e[66],subject:msg[_0xbd3e[35]],from:_[_0xbd3e[40]](msg[_0xbd3e[38]],_0xbd3e[37]),to:msg[_0xbd3e[67]]?_[_0xbd3e[40]](msg[_0xbd3e[67]],_0xbd3e[37]):[],cc:msg[_0xbd3e[39]]?_[_0xbd3e[40]](msg[_0xbd3e[39]],_0xbd3e[37]):[],bcc:msg[_0xbd3e[68]]?_[_0xbd3e[40]](msg[_0xbd3e[68]],_0xbd3e[37]):[],text:msg[_0xbd3e[69]]|| null,MailRoomId:_0xe841x1b[_0xbd3e[33]],accountName:_0xe841x1d[_0xbd3e[36]],accountId:_0xe841x1d[_0xbd3e[33]],inReplyTo:msg[_0xbd3e[27]][0]})})[_0xbd3e[51]](function(_0xe841x25){var _0xe841x26=[];var _0xe841x27=_0xe841x25;var _0xe841x28= new Scheduler({channel:_0xbd3e[30],uniqueid:util[_0xbd3e[34]](_0xbd3e[31],moment()[_0xbd3e[32]](),_0xe841x1b[_0xbd3e[33]]),subject:msg[_0xbd3e[35]],messageid:_0xe841x27[_0xbd3e[33]],roomid:_0xe841x1b[_0xbd3e[33]],accountid:_0xe841x1d[_0xbd3e[33]],accountname:_0xe841x1d[_0xbd3e[36]],accountaddress:_0xe841x1d[_0xbd3e[37]],from:msg[_0xbd3e[38]][0][_0xbd3e[37]],cc:msg[_0xbd3e[39]]?_[_0xbd3e[40]](msg[_0xbd3e[39]],_0xbd3e[37]):[]},_0xe841x27[_0xbd3e[41]]);_0xe841x28[_0xbd3e[42]]();if(msg[_0xbd3e[43]]&& msg[_0xbd3e[43]][_0xbd3e[44]]){msg[_0xbd3e[43]][_0xbd3e[63]](function(_0xe841x29){var _0xe841x2a=_0xbd3e[45]+ Math[_0xbd3e[46]](32);var _0xe841x2b;_0xe841x26[_0xbd3e[62]](Attachment[_0xbd3e[61]]({name:_0xe841x29[_0xbd3e[48]],basename:_0xe841x2a,path:path[_0xbd3e[59]](config[_0xbd3e[55]],_0xbd3e[56],_0xbd3e[57],_0xbd3e[43],_0xbd3e[58],_0xe841x2a),type:_0xe841x29[_0xbd3e[60]],size:_0xe841x29[_0xbd3e[44]],MailMessageId:_0xe841x27[_0xbd3e[33]]})[_0xbd3e[51]](function(_0xe841x2d){return open(_0xe841x2d[_0xbd3e[3]],_0xbd3e[54])})[_0xbd3e[51]](function(_0xe841x2c){_0xe841x2b= _0xe841x2c;return write(_0xe841x2b, new Buffer(_0xe841x29[_0xbd3e[53]][_0xbd3e[52]]),0,_0xe841x29[_0xbd3e[44]])})[_0xbd3e[51]](function(){return close(_0xe841x2b)})[_0xbd3e[51]](function(){console[_0xbd3e[50]](_0xbd3e[47],_0xe841x29[_0xbd3e[48]],_0xbd3e[49])})[_0xbd3e[29]](function(_0xe841x24){console[_0xbd3e[28]](_0xe841x24)}))})};return Promise[_0xbd3e[64]](_0xe841x26)})[_0xbd3e[29]](function(_0xe841x24){console[_0xbd3e[28]](_0xe841x24)})}else {return Account[_0xbd3e[81]](msg[_0xbd3e[80]])[_0xbd3e[51]](function(_0xe841x31){_0xe841x1d= _0xe841x31;if(_0xe841x1d[_0xbd3e[75]]){return Company[_0xbd3e[79]]({where:{emailDomain:msg[_0xbd3e[38]][0][_0xbd3e[37]][_0xbd3e[77]](_0xbd3e[76])[1]}})[_0xbd3e[51]](function(_0xe841x32){return Contact[_0xbd3e[78]]({where:{email:msg[_0xbd3e[38]][0][_0xbd3e[37]]},defaults:{email:msg[_0xbd3e[38]][0][_0xbd3e[37]],firstName:msg[_0xbd3e[38]][0][_0xbd3e[36]]|| msg[_0xbd3e[38]][0][_0xbd3e[37]][_0xbd3e[77]](_0xbd3e[76])[0],ListId:_0xe841x1d[_0xbd3e[75]],CompanyId:_0xe841x32?_0xe841x32[_0xbd3e[33]]:null}})})}else {return []}})[_0xbd3e[74]](function(_0xe841x30){_0xe841x1e= _0xe841x30;return Room[_0xbd3e[61]]({mailIn:1,account:_0xe841x1d[_0xbd3e[36]],subject:msg[_0xbd3e[35]],from:_[_0xbd3e[40]](msg[_0xbd3e[38]],_0xbd3e[37])[_0xbd3e[59]](_0xbd3e[84]),status:_0xbd3e[88],lastEvent:_0xbd3e[66],lastEventAt:moment()[_0xbd3e[34]](_0xbd3e[85]),arrivedAt:moment()[_0xbd3e[34]](_0xbd3e[85]),attachment:msg[_0xbd3e[43]]&& msg[_0xbd3e[43]][_0xbd3e[44]],MailMessages:[{messageId:msg[_0xbd3e[65]],subject:msg[_0xbd3e[35]],from:_[_0xbd3e[40]](msg[_0xbd3e[38]],_0xbd3e[37]),fromId:_0xe841x1e?_0xe841x1e[_0xbd3e[33]]:null,to:msg[_0xbd3e[67]]?_[_0xbd3e[40]](msg[_0xbd3e[67]],_0xbd3e[37]):[],cc:msg[_0xbd3e[39]]?_[_0xbd3e[40]](msg[_0xbd3e[39]],_0xbd3e[37]):[],bcc:msg[_0xbd3e[68]]?_[_0xbd3e[40]](msg[_0xbd3e[68]],_0xbd3e[37]):[],status:_0xbd3e[66],text:msg[_0xbd3e[69]]|| null,accountName:_0xe841x1d[_0xbd3e[36]],accountId:_0xe841x1d[_0xbd3e[33]]}],MailAccountId:msg[_0xbd3e[80]]},{include:[{model:Message}]})})[_0xbd3e[51]](function(_0xe841x33){var _0xe841x26=[];var _0xe841x34=_0xe841x33;var _0xe841x28= new Scheduler({channel:_0xbd3e[30],uniqueid:util[_0xbd3e[34]](_0xbd3e[31],moment()[_0xbd3e[32]](),_0xe841x34[_0xbd3e[33]]),subject:msg[_0xbd3e[35]],messageid:_0xe841x34[_0xbd3e[87]][0][_0xbd3e[33]],roomid:_0xe841x34[_0xbd3e[33]],accountid:_0xe841x1d[_0xbd3e[33]],accountname:_0xe841x1d[_0xbd3e[36]],accountaddress:_0xe841x1d[_0xbd3e[37]],from:msg[_0xbd3e[38]][0][_0xbd3e[37]],cc:msg[_0xbd3e[39]]?_[_0xbd3e[40]](msg[_0xbd3e[39]],_0xbd3e[37]):[]},_0xe841x34[_0xbd3e[87]][0][_0xbd3e[41]]);_0xe841x28[_0xbd3e[42]]();if(msg[_0xbd3e[43]]&& msg[_0xbd3e[43]][_0xbd3e[44]]){msg[_0xbd3e[43]][_0xbd3e[63]](function(_0xe841x29){var _0xe841x2a=_0xbd3e[45]+ Math[_0xbd3e[46]](32);var _0xe841x2b;_0xe841x26[_0xbd3e[62]](Attachment[_0xbd3e[61]]({name:_0xe841x29[_0xbd3e[48]],basename:_0xe841x2a,path:path[_0xbd3e[59]](config[_0xbd3e[55]],_0xbd3e[56],_0xbd3e[57],_0xbd3e[43],_0xbd3e[58],_0xe841x2a),type:_0xe841x29[_0xbd3e[60]],size:_0xe841x29[_0xbd3e[44]],MailMessageId:_0xe841x34[_0xbd3e[87]][0][_0xbd3e[33]]})[_0xbd3e[51]](function(_0xe841x2d){return open(_0xe841x2d[_0xbd3e[3]],_0xbd3e[54])})[_0xbd3e[51]](function(_0xe841x2c){_0xe841x2b= _0xe841x2c;return write(_0xe841x2b, new Buffer(_0xe841x29[_0xbd3e[53]][_0xbd3e[52]]),0,_0xe841x29[_0xbd3e[44]])})[_0xbd3e[51]](function(){return close(_0xe841x2b)})[_0xbd3e[51]](function(){console[_0xbd3e[50]](_0xbd3e[47],_0xe841x29[_0xbd3e[48]],_0xbd3e[49])})[_0xbd3e[29]](function(_0xe841x24){console[_0xbd3e[28]](_0xe841x24)}))})};return Promise[_0xbd3e[64]](_0xe841x26)})[_0xbd3e[29]](function(_0xe841x24){console[_0xbd3e[28]](_0xe841x24)})}}function handleState(_0xe841x36,_0xe841x37){return ms[_0xbd3e[81]](_0xe841x36)[_0xbd3e[51]](function(_0xe841x38){return _0xe841x38[_0xbd3e[71]]({state:_0xe841x37[_0xbd3e[89]],source:_0xe841x37[_0xbd3e[90]]|| null})})[_0xbd3e[29]](function(_0xe841x24){console[_0xbd3e[28]](_0xe841x24)})}function fork(_0xe841x36,_0xe841x3a){return cp[_0xbd3e[97]](__dirname+ _0xbd3e[96],[_0xe841x36,_0xe841x3a])[_0xbd3e[91]](_0xbd3e[93],function(_0xe841x37){switch(_0xe841x37[_0xbd3e[95]]){case _0xbd3e[94]:handleMessage(_0xe841x37);break;case _0xbd3e[89]:handleState(_0xe841x36,_0xe841x37);break;default:}})[_0xbd3e[91]](_0xbd3e[22],function(_0xe841x3b){console[_0xbd3e[50]](util[_0xbd3e[34]](_0xbd3e[92],_0xe841x3a,_0xe841x3b))})[_0xbd3e[91]](_0xbd3e[28],function(_0xe841x24){console[_0xbd3e[28]](_0xe841x24)})}function execRequest(_0xe841x3d,_0xe841x3e,_0xe841x3f){Util[_0xbd3e[100]](_0xe841x3d,_0xe841x3e,_0xe841x3f)[_0xbd3e[51]](function(_0xe841x40){console[_0xbd3e[50]](_0xbd3e[99])})[_0xbd3e[29]](function(_0xe841x24){console[_0xbd3e[50]](_0xbd3e[98])})}function webhook(_0xe841x3d,_0xe841x42,_0xe841x43){var _0xe841x44=_0xe841x42;switch(_0xe841x43){case _0xbd3e[108]:if(_0xe841x44[_0xbd3e[101]]&& _0xe841x44[_0xbd3e[102]]){console[_0xbd3e[50]](_0xbd3e[103]+ _0xe841x44[_0xbd3e[36]]+ _0xbd3e[104]);execRequest(_0xe841x3d[_0xbd3e[41]],_0xe841x44[_0xbd3e[101]],_0xe841x44[_0xbd3e[102]])};if(_0xe841x44[_0xbd3e[105]][_0xbd3e[44]]){_[_0xbd3e[63]](_0xe841x44[_0xbd3e[105]],function(_0xe841x45){if(_0xe841x45[_0xbd3e[106]]){Util[_0xbd3e[107]](_0xe841x45,_0xe841x3d)}})};break;case _0xbd3e[112]:if(_0xe841x44[_0xbd3e[109]]&& _0xe841x44[_0xbd3e[110]]){console[_0xbd3e[50]](_0xbd3e[103]+ _0xe841x44[_0xbd3e[36]]+ _0xbd3e[111]);execRequest(_0xe841x3d[_0xbd3e[41]],_0xe841x44[_0xbd3e[109]],_0xe841x44[_0xbd3e[110]])};break;case _0xbd3e[22]:if(_0xe841x44[_0xbd3e[113]]&& _0xe841x44[_0xbd3e[114]]){console[_0xbd3e[50]](_0xbd3e[103]+ _0xe841x44[_0xbd3e[36]]+ _0xbd3e[115]);execRequest(_0xe841x3d[_0xbd3e[41]],_0xe841x44[_0xbd3e[113]],_0xe841x44[_0xbd3e[114]])};break;default:console[_0xbd3e[50]](_0xbd3e[116])}}function synch(mailaccounts){Account[_0xbd3e[118]](function(_0xe841x3d){_[_0xbd3e[117]](mailaccounts,{id:_0xe841x3d[_0xbd3e[33]]})});Account[_0xbd3e[121]](function(_0xe841x3d){console[_0xbd3e[50]](_0xbd3e[119]+ _0xe841x3d[_0xbd3e[36]]+ _0xbd3e[120]);mailaccounts[_0xbd3e[62]](_0xe841x3d)});Account[_0xbd3e[126]](function(_0xe841x3d){var _0xe841x47=_[_0xbd3e[122]](mailaccounts,{id:_0xe841x3d[_0xbd3e[33]]});if(_0xe841x47){console[_0xbd3e[50]](_0xbd3e[119]+ _0xe841x47[_0xbd3e[36]]+ _0xbd3e[123]);_[_0xbd3e[124]](_0xe841x47,_0xe841x3d)}else {mailaccounts[_0xbd3e[125]](_0xe841x3d)}})}module[_0xbd3e[127]]= function(){var _0xe841x48={};var _0xe841x49;process[_0xbd3e[91]](_0xbd3e[128],function(_0xe841x3b){for(var _0xe841x4a in _0xe841x48){if(_0xe841x48[_0xe841x4a]){_0xe841x48[_0xe841x4a][_0xbd3e[129]]()}}});Account[_0xbd3e[135]]()[_0xbd3e[51]](function(_0xe841x4b){mailaccounts= _0xe841x4b;synch(mailaccounts);ReportMail[_0xbd3e[126]](function(_0xe841x3d){var _0xe841x42=_[_0xbd3e[122]](mailaccounts,{id:parseInt(_0xe841x3d[_0xbd3e[130]])});if(_0xe841x42&& _0xe841x3d[_0xbd3e[132]](_0xbd3e[131])){webhook(_0xe841x3d,_0xe841x42,_0xbd3e[108])};if(_0xe841x42&& _0xe841x3d[_0xbd3e[132]](_0xbd3e[133])){webhook(_0xe841x3d,_0xe841x42,_0xbd3e[112])}});Room[_0xbd3e[126]](function(_0xe841x3d){var _0xe841x42=_[_0xbd3e[122]](mailaccounts,{id:_0xe841x3d[_0xbd3e[134]]});if(_0xe841x42&& _0xe841x3d[_0xbd3e[132]](_0xbd3e[72])&& _0xe841x3d[_0xbd3e[72]]=== _0xbd3e[73]){webhook(_0xe841x3d,_0xe841x42,_0xbd3e[22])}})})[_0xbd3e[29]](function(_0xe841x24){console[_0xbd3e[28]](_0xe841x24)});ms[_0xbd3e[121]](function(_0xe841x38){_0xe841x48[_0xe841x38[_0xbd3e[33]]]= fork(_0xe841x38[_0xbd3e[33]],_0xe841x38[_0xbd3e[136]])});ms[_0xbd3e[126]](function(_0xe841x38){if(_0xe841x48[_0xe841x38[_0xbd3e[33]]]){if(_0xe841x38[_0xbd3e[132]](_0xbd3e[89])|| _0xe841x38[_0xbd3e[132]](_0xbd3e[90])){console[_0xbd3e[50]](util[_0xbd3e[34]](_0xbd3e[137],_0xe841x38[_0xbd3e[33]],_0xe841x48[_0xe841x38[_0xbd3e[33]]][_0xbd3e[138]]));clearTimeout(_0xe841x49);switch(_0xe841x38[_0xbd3e[89]]){case _0xbd3e[139]:_0xe841x49= setTimeout(function(){_0xe841x48[_0xe841x38[_0xbd3e[33]]]= fork(_0xe841x38[_0xbd3e[33]],_0xe841x38[_0xbd3e[136]])},10000);break;default:}}else {_0xe841x48[_0xe841x38[_0xbd3e[33]]][_0xbd3e[129]]();_0xe841x48[_0xe841x38[_0xbd3e[33]]]= null;_0xe841x48[_0xe841x38[_0xbd3e[33]]]= fork(_0xe841x38[_0xbd3e[33]],_0xe841x38[_0xbd3e[136]])}}});ms[_0xbd3e[118]](function(_0xe841x38){if(_0xe841x48[_0xe841x38[_0xbd3e[33]]]){console[_0xbd3e[50]](util[_0xbd3e[34]](_0xbd3e[140],_0xe841x38[_0xbd3e[33]],_0xe841x48[_0xe841x38[_0xbd3e[33]]][_0xbd3e[138]]));_0xe841x48[_0xe841x38[_0xbd3e[33]]][_0xbd3e[129]]();_0xe841x48[_0xe841x38[_0xbd3e[33]]]= null}});ms[_0xbd3e[135]]()[_0xbd3e[51]](function(_0xe841x4c){_0xe841x4c[_0xbd3e[63]](function(_0xe841x38){_0xe841x48[_0xe841x38[_0xbd3e[33]]]= fork(_0xe841x38[_0xbd3e[33]],_0xe841x38[_0xbd3e[136]])})})[_0xbd3e[29]](function(_0xe841x24){console[_0xbd3e[28]](_0xe841x24)})}
\ No newline at end of file