Built motion from commit b6cf875.|1.0.15
[motion.git] / server / config / imap / index.js
index 4f1c6be..b7a9cbe 100644 (file)
@@ -1 +1 @@
-var _0xad34=["\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","\x64\x61\x74\x61\x56\x61\x6C\x75\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","\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"];_0xad34[0];const _=require(_0xad34[1]);const util=require(_0xad34[2]);const path=require(_0xad34[3]);const cp=require(_0xad34[4]);const ms=require(_0xad34[6])[_0xad34[5]];const msg=require(_0xad34[6])[_0xad34[7]];const Room=require(_0xad34[6])[_0xad34[8]];const Status=require(_0xad34[6])[_0xad34[9]];const Message=require(_0xad34[6])[_0xad34[7]];const Account=require(_0xad34[6])[_0xad34[10]];const Contact=require(_0xad34[6])[_0xad34[11]];const Company=require(_0xad34[6])[_0xad34[12]];const Attachment=require(_0xad34[6])[_0xad34[13]];const ReportMail=require(_0xad34[6])[_0xad34[14]];const ReportMailRoom=require(_0xad34[6])[_0xad34[15]];const ReportMailSession=require(_0xad34[6])[_0xad34[16]];const Promise=require(_0xad34[17]);const moment=require(_0xad34[18]);const open=Promise[_0xad34[21]](require(_0xad34[20])[_0xad34[19]]);const close=Promise[_0xad34[21]](require(_0xad34[20])[_0xad34[22]]);const write=Promise[_0xad34[21]](require(_0xad34[20])[_0xad34[23]]);const config=require(_0xad34[24]);var Scheduler=require(_0xad34[25]);var Util=require(_0xad34[26]);function handleMessage(msg){var _0xf261x1a;var _0xf261x1b;var _0xf261x1c;var _0xf261x1d;var _0xf261x1e;var _0xf261x1f,_0xf261x20,_0xf261x21,_0xf261x22;if(msg[_0xad34[27]]){return Message[_0xad34[78]]({where:{messageId:msg[_0xad34[27]][0]}})[_0xad34[50]](function(_0xf261x2e){if(_0xf261x2e){return _0xf261x2e[_0xad34[85]]()[_0xad34[50]](function(_0xf261x2d){_0xf261x1a= _0xf261x2d;if(_0xf261x2d[_0xad34[71]]!== _0xad34[72]){return _0xf261x1a[_0xad34[70]]({status:_0xad34[81],openReason:_0xad34[82]},{individualHooks:true})[_0xad34[50]](function(){return Account[_0xad34[80]](msg[_0xad34[79]])[_0xad34[50]](function(_0xf261x30){_0xf261x1c= _0xf261x30;if(_0xf261x1c[_0xad34[74]]){return Company[_0xad34[78]]({where:{emailDomain:msg[_0xad34[38]][0][_0xad34[37]][_0xad34[76]](_0xad34[75])[1]}})[_0xad34[50]](function(_0xf261x31){return Contact[_0xad34[77]]({where:{email:msg[_0xad34[38]][0][_0xad34[37]]},defaults:{email:msg[_0xad34[38]][0][_0xad34[37]],firstName:msg[_0xad34[38]][0][_0xad34[36]]|| msg[_0xad34[38]][0][_0xad34[37]][_0xad34[76]](_0xad34[75])[0],ListId:_0xf261x1c[_0xad34[74]],CompanyId:_0xf261x31?_0xf261x31[_0xad34[33]]:null}})})}else {return []}})[_0xad34[73]](function(_0xf261x2f){_0xf261x1d= _0xf261x2f})})}else {return Account[_0xad34[80]](msg[_0xad34[79]])[_0xad34[50]](function(_0xf261x30){_0xf261x1c= _0xf261x30;if(_0xf261x1c[_0xad34[74]]){return Company[_0xad34[78]]({where:{emailDomain:msg[_0xad34[38]][0][_0xad34[37]][_0xad34[76]](_0xad34[75])[1]}})[_0xad34[50]](function(_0xf261x31){return Contact[_0xad34[77]]({where:{email:msg[_0xad34[38]][0][_0xad34[37]]},defaults:{email:msg[_0xad34[38]][0][_0xad34[37]],firstName:msg[_0xad34[38]][0][_0xad34[36]]|| msg[_0xad34[38]][0][_0xad34[37]][_0xad34[76]](_0xad34[75])[0],ListId:_0xf261x1c[_0xad34[74]],CompanyId:_0xf261x31?_0xf261x31[_0xad34[33]]:null}})})}else {return []}})[_0xad34[73]](function(_0xf261x2f){_0xf261x1d= _0xf261x2f;return Room[_0xad34[60]]({subject:msg[_0xad34[35]],from:_[_0xad34[40]](msg[_0xad34[38]],_0xad34[37])[_0xad34[58]](_0xad34[83]),account:_0xf261x1c[_0xad34[36]],attachment:msg[_0xad34[42]]&& msg[_0xad34[42]][_0xad34[43]],lastEvent:_0xad34[65],lastEventAt:moment()[_0xad34[34]](_0xad34[84]),arrivedAt:moment()[_0xad34[34]](_0xad34[84]),MailAccountId:_0xf261x1c[_0xad34[33]],ParentId:_0xf261x2d[_0xad34[33]]})})[_0xad34[50]](function(_0xf261x2d){_0xf261x1a= _0xf261x2d})}})}else {return Account[_0xad34[80]](msg[_0xad34[79]])[_0xad34[50]](function(_0xf261x30){_0xf261x1c= _0xf261x30;if(_0xf261x1c[_0xad34[74]]){return Company[_0xad34[78]]({where:{emailDomain:msg[_0xad34[38]][0][_0xad34[37]][_0xad34[76]](_0xad34[75])[1]}})[_0xad34[50]](function(_0xf261x31){return Contact[_0xad34[77]]({where:{email:msg[_0xad34[38]][0][_0xad34[37]]},defaults:{email:msg[_0xad34[38]][0][_0xad34[37]],firstName:msg[_0xad34[38]][0][_0xad34[36]]|| msg[_0xad34[38]][0][_0xad34[37]][_0xad34[76]](_0xad34[75])[0],ListId:_0xf261x1c[_0xad34[74]],CompanyId:_0xf261x31?_0xf261x31[_0xad34[33]]:null}})})}else {return []}})[_0xad34[73]](function(_0xf261x2f){_0xf261x1d= _0xf261x2f;return Room[_0xad34[60]]({subject:msg[_0xad34[35]],from:_[_0xad34[40]](msg[_0xad34[38]],_0xad34[37])[_0xad34[58]](_0xad34[83]),account:_0xf261x1c[_0xad34[36]],attachment:msg[_0xad34[42]]&& msg[_0xad34[42]][_0xad34[43]],lastEvent:_0xad34[65],lastEventAt:moment()[_0xad34[34]](_0xad34[84]),arrivedAt:moment()[_0xad34[34]](_0xad34[84]),MailAccountId:_0xf261x1c[_0xad34[33]]})})[_0xad34[50]](function(_0xf261x2d){_0xf261x1a= _0xf261x2d})}})[_0xad34[50]](function(){return _0xf261x1a[_0xad34[70]]({lastEvent:_0xad34[65],mailIn:++_0xf261x1a[_0xad34[69]]})})[_0xad34[50]](function(_0xf261x2d){return Message[_0xad34[60]]({fromId:_0xf261x1d?_0xf261x1d[_0xad34[33]]:null,messageId:msg[_0xad34[64]],status:_0xad34[65],subject:msg[_0xad34[35]],from:_[_0xad34[40]](msg[_0xad34[38]],_0xad34[37]),to:msg[_0xad34[66]]?_[_0xad34[40]](msg[_0xad34[66]],_0xad34[37]):[],cc:msg[_0xad34[39]]?_[_0xad34[40]](msg[_0xad34[39]],_0xad34[37]):[],bcc:msg[_0xad34[67]]?_[_0xad34[40]](msg[_0xad34[67]],_0xad34[37]):[],text:msg[_0xad34[68]]|| null,MailRoomId:_0xf261x1a[_0xad34[33]]})})[_0xad34[50]](function(_0xf261x24){var _0xf261x25=[];var _0xf261x26=_0xf261x24;var _0xf261x27= new Scheduler({channel:_0xad34[30],uniqueid:util[_0xad34[34]](_0xad34[31],moment()[_0xad34[32]](),_0xf261x1a[_0xad34[33]]),subject:msg[_0xad34[35]],messageid:_0xf261x26[_0xad34[33]],roomid:_0xf261x1a[_0xad34[33]],accountid:_0xf261x1c[_0xad34[33]],accountname:_0xf261x1c[_0xad34[36]],accountaddress:_0xf261x1c[_0xad34[37]],from:msg[_0xad34[38]][0][_0xad34[37]],cc:msg[_0xad34[39]]?_[_0xad34[40]](msg[_0xad34[39]],_0xad34[37]):[]});_0xf261x27[_0xad34[41]]();if(msg[_0xad34[42]]&& msg[_0xad34[42]][_0xad34[43]]){msg[_0xad34[42]][_0xad34[62]](function(_0xf261x28){var _0xf261x29=_0xad34[44]+ Math[_0xad34[45]](32);var _0xf261x2a;_0xf261x25[_0xad34[61]](Attachment[_0xad34[60]]({name:_0xf261x28[_0xad34[47]],basename:_0xf261x29,path:path[_0xad34[58]](config[_0xad34[54]],_0xad34[55],_0xad34[56],_0xad34[42],_0xad34[57],_0xf261x29),type:_0xf261x28[_0xad34[59]],size:_0xf261x28[_0xad34[43]],MailMessageId:_0xf261x26[_0xad34[33]]})[_0xad34[50]](function(_0xf261x2c){return open(_0xf261x2c[_0xad34[3]],_0xad34[53])})[_0xad34[50]](function(_0xf261x2b){_0xf261x2a= _0xf261x2b;return write(_0xf261x2a, new Buffer(_0xf261x28[_0xad34[52]][_0xad34[51]]),0,_0xf261x28[_0xad34[43]])})[_0xad34[50]](function(){return close(_0xf261x2a)})[_0xad34[50]](function(){console[_0xad34[49]](_0xad34[46],_0xf261x28[_0xad34[47]],_0xad34[48])})[_0xad34[29]](function(_0xf261x23){console[_0xad34[28]](_0xf261x23)}))})};return Promise[_0xad34[63]](_0xf261x25)})[_0xad34[29]](function(_0xf261x23){console[_0xad34[28]](_0xf261x23)})}else {return Account[_0xad34[80]](msg[_0xad34[79]])[_0xad34[50]](function(_0xf261x30){_0xf261x1c= _0xf261x30;if(_0xf261x1c[_0xad34[74]]){return Company[_0xad34[78]]({where:{emailDomain:msg[_0xad34[38]][0][_0xad34[37]][_0xad34[76]](_0xad34[75])[1]}})[_0xad34[50]](function(_0xf261x31){return Contact[_0xad34[77]]({where:{email:msg[_0xad34[38]][0][_0xad34[37]]},defaults:{email:msg[_0xad34[38]][0][_0xad34[37]],firstName:msg[_0xad34[38]][0][_0xad34[36]]|| msg[_0xad34[38]][0][_0xad34[37]][_0xad34[76]](_0xad34[75])[0],ListId:_0xf261x1c[_0xad34[74]],CompanyId:_0xf261x31?_0xf261x31[_0xad34[33]]:null}})})}else {return []}})[_0xad34[73]](function(_0xf261x2f){_0xf261x1d= _0xf261x2f;return Room[_0xad34[60]]({mailIn:1,account:_0xf261x1c[_0xad34[36]],subject:msg[_0xad34[35]],from:_[_0xad34[40]](msg[_0xad34[38]],_0xad34[37])[_0xad34[58]](_0xad34[83]),status:_0xad34[88],lastEvent:_0xad34[65],lastEventAt:moment()[_0xad34[34]](_0xad34[84]),arrivedAt:moment()[_0xad34[34]](_0xad34[84]),attachment:msg[_0xad34[42]]&& msg[_0xad34[42]][_0xad34[43]],MailMessages:[{messageId:msg[_0xad34[64]],subject:msg[_0xad34[35]],from:_[_0xad34[40]](msg[_0xad34[38]],_0xad34[37]),fromId:_0xf261x1d?_0xf261x1d[_0xad34[33]]:null,to:msg[_0xad34[66]]?_[_0xad34[40]](msg[_0xad34[66]],_0xad34[37]):[],cc:msg[_0xad34[39]]?_[_0xad34[40]](msg[_0xad34[39]],_0xad34[37]):[],bcc:msg[_0xad34[67]]?_[_0xad34[40]](msg[_0xad34[67]],_0xad34[37]):[],status:_0xad34[65],text:msg[_0xad34[68]]|| null}],MailAccountId:msg[_0xad34[79]]},{include:[{model:Message}]})})[_0xad34[50]](function(_0xf261x32){var _0xf261x25=[];var _0xf261x33=_0xf261x32;var _0xf261x27= new Scheduler({channel:_0xad34[30],uniqueid:util[_0xad34[34]](_0xad34[31],moment()[_0xad34[32]](),_0xf261x33[_0xad34[33]]),subject:msg[_0xad34[35]],messageid:_0xf261x33[_0xad34[86]][0][_0xad34[33]],roomid:_0xf261x33[_0xad34[33]],accountid:_0xf261x1c[_0xad34[33]],accountname:_0xf261x1c[_0xad34[36]],accountaddress:_0xf261x1c[_0xad34[37]],from:msg[_0xad34[38]][0][_0xad34[37]],cc:msg[_0xad34[39]]?_[_0xad34[40]](msg[_0xad34[39]],_0xad34[37]):[]},_0xf261x33[_0xad34[86]][0][_0xad34[87]]);_0xf261x27[_0xad34[41]]();if(msg[_0xad34[42]]&& msg[_0xad34[42]][_0xad34[43]]){msg[_0xad34[42]][_0xad34[62]](function(_0xf261x28){var _0xf261x29=_0xad34[44]+ Math[_0xad34[45]](32);var _0xf261x2a;_0xf261x25[_0xad34[61]](Attachment[_0xad34[60]]({name:_0xf261x28[_0xad34[47]],basename:_0xf261x29,path:path[_0xad34[58]](config[_0xad34[54]],_0xad34[55],_0xad34[56],_0xad34[42],_0xad34[57],_0xf261x29),type:_0xf261x28[_0xad34[59]],size:_0xf261x28[_0xad34[43]],MailMessageId:_0xf261x33[_0xad34[86]][0][_0xad34[33]]})[_0xad34[50]](function(_0xf261x2c){return open(_0xf261x2c[_0xad34[3]],_0xad34[53])})[_0xad34[50]](function(_0xf261x2b){_0xf261x2a= _0xf261x2b;return write(_0xf261x2a, new Buffer(_0xf261x28[_0xad34[52]][_0xad34[51]]),0,_0xf261x28[_0xad34[43]])})[_0xad34[50]](function(){return close(_0xf261x2a)})[_0xad34[50]](function(){console[_0xad34[49]](_0xad34[46],_0xf261x28[_0xad34[47]],_0xad34[48])})[_0xad34[29]](function(_0xf261x23){console[_0xad34[28]](_0xf261x23)}))})};return Promise[_0xad34[63]](_0xf261x25)})[_0xad34[29]](function(_0xf261x23){console[_0xad34[28]](_0xf261x23)})}}function handleState(_0xf261x35,_0xf261x36){return ms[_0xad34[80]](_0xf261x35)[_0xad34[50]](function(_0xf261x37){return _0xf261x37[_0xad34[70]]({state:_0xf261x36[_0xad34[89]],source:_0xf261x36[_0xad34[90]]|| null})})[_0xad34[29]](function(_0xf261x23){console[_0xad34[28]](_0xf261x23)})}function fork(_0xf261x35,_0xf261x39){return cp[_0xad34[97]](__dirname+ _0xad34[96],[_0xf261x35,_0xf261x39])[_0xad34[91]](_0xad34[93],function(_0xf261x36){switch(_0xf261x36[_0xad34[95]]){case _0xad34[94]:handleMessage(_0xf261x36);break;case _0xad34[89]:handleState(_0xf261x35,_0xf261x36);break;default:}})[_0xad34[91]](_0xad34[22],function(_0xf261x3a){console[_0xad34[49]](util[_0xad34[34]](_0xad34[92],_0xf261x39,_0xf261x3a))})[_0xad34[91]](_0xad34[28],function(_0xf261x23){console[_0xad34[28]](_0xf261x23)})}function execRequest(_0xf261x3c,_0xf261x3d,_0xf261x3e){Util[_0xad34[100]](_0xf261x3c,_0xf261x3d,_0xf261x3e)[_0xad34[50]](function(_0xf261x3f){console[_0xad34[49]](_0xad34[99])})[_0xad34[29]](function(_0xf261x23){console[_0xad34[49]](_0xad34[98])})}function onReportUpdate(_0xf261x3c){var _0xf261x41;if(_0xf261x3c[_0xad34[102]](_0xad34[101])){return Account[_0xad34[80]](parseInt(_0xf261x3c[_0xad34[111]]))[_0xad34[50]](function(_0xf261x30){if(!_0xf261x30){throw  new Error(_0xad34[104])};_0xf261x41= _0xf261x30;if(_0xf261x41[_0xad34[105]]&& _0xf261x41[_0xad34[106]]){execRequest(_0xf261x3c[_0xad34[87]],_0xf261x41[_0xad34[105]],_0xf261x41[_0xad34[106]])}else {throw  new Error(_0xad34[107])};if(_0xf261x41[_0xad34[108]][_0xad34[43]]){_[_0xad34[62]](_0xf261x41[_0xad34[108]],function(_0xf261x42){if(_0xf261x42[_0xad34[109]]){Util[_0xad34[110]](_0xf261x42,_0xf261x3c)}})}})[_0xad34[29]](function(_0xf261x23){console[_0xad34[49]](_0xad34[103],_0xf261x23)})};if(_0xf261x3c[_0xad34[102]](_0xad34[112])){return Account[_0xad34[80]](_0xf261x3c[_0xad34[111]])[_0xad34[50]](function(_0xf261x30){if(!_0xf261x30){throw  new Error(_0xad34[113])};_0xf261x41= _0xf261x30;if(_0xf261x41[_0xad34[114]]&& _0xf261x41[_0xad34[115]]){execRequest(_0xf261x3c[_0xad34[87]],_0xf261x41[_0xad34[114]],_0xf261x41[_0xad34[115]])}})[_0xad34[29]](function(_0xf261x23){console[_0xad34[49]](_0xad34[103],_0xf261x23)})}}module[_0xad34[116]]= function(){var _0xf261x43={};var _0xf261x44;process[_0xad34[91]](_0xad34[117],function(_0xf261x3a){for(var _0xf261x45 in _0xf261x43){if(_0xf261x43[_0xf261x45]){_0xf261x43[_0xf261x45][_0xad34[118]]()}}});ReportMail[_0xad34[119]](function(_0xf261x3c){onReportUpdate(_0xf261x3c)});ms[_0xad34[121]](function(_0xf261x37){_0xf261x43[_0xf261x37[_0xad34[33]]]= fork(_0xf261x37[_0xad34[33]],_0xf261x37[_0xad34[120]])});ms[_0xad34[119]](function(_0xf261x37){if(_0xf261x43[_0xf261x37[_0xad34[33]]]){if(_0xf261x37[_0xad34[102]](_0xad34[89])|| _0xf261x37[_0xad34[102]](_0xad34[90])){console[_0xad34[49]](util[_0xad34[34]](_0xad34[122],_0xf261x37[_0xad34[33]],_0xf261x43[_0xf261x37[_0xad34[33]]][_0xad34[123]]));clearTimeout(_0xf261x44);switch(_0xf261x37[_0xad34[89]]){case _0xad34[124]:_0xf261x44= setTimeout(function(){_0xf261x43[_0xf261x37[_0xad34[33]]]= fork(_0xf261x37[_0xad34[33]],_0xf261x37[_0xad34[120]])},10000);break;default:}}else {_0xf261x43[_0xf261x37[_0xad34[33]]][_0xad34[118]]();_0xf261x43[_0xf261x37[_0xad34[33]]]= null;_0xf261x43[_0xf261x37[_0xad34[33]]]= fork(_0xf261x37[_0xad34[33]],_0xf261x37[_0xad34[120]])}}});ms[_0xad34[126]](function(_0xf261x37){if(_0xf261x43[_0xf261x37[_0xad34[33]]]){console[_0xad34[49]](util[_0xad34[34]](_0xad34[125],_0xf261x37[_0xad34[33]],_0xf261x43[_0xf261x37[_0xad34[33]]][_0xad34[123]]));_0xf261x43[_0xf261x37[_0xad34[33]]][_0xad34[118]]();_0xf261x43[_0xf261x37[_0xad34[33]]]= null}});ms[_0xad34[127]]()[_0xad34[50]](function(_0xf261x46){_0xf261x46[_0xad34[62]](function(_0xf261x37){_0xf261x43[_0xf261x37[_0xad34[33]]]= fork(_0xf261x37[_0xad34[33]],_0xf261x37[_0xad34[120]])})})[_0xad34[29]](function(_0xf261x23){console[_0xad34[28]](_0xf261x23)})}
\ No newline at end of file
+var _0x6711=["\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","\x52\x65\x70\x6F\x72\x74\x4D\x61\x69\x6C","\x4D\x61\x69\x6C\x52\x6F\x6F\x6D\x53\x74\x61\x74\x75\x73","\x52\x65\x70\x6F\x72\x74\x4D\x61\x69\x6C\x53\x65\x73\x73\x69\x6F\x6E","\x53\x6D\x73\x4D\x65\x73\x73\x61\x67\x65","\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\x6F\x6F\x6D","\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\x75\x74\x69\x6C","\x67\x65\x74","\x63\x6F\x6E\x6E\x65\x63\x74\x69\x64","\x63\x68\x61\x6E\x67\x65\x64","\x65\x72\x72\x6F\x72","\x63\x61\x74\x63\x68","\x6D\x65\x73\x73\x61\x67\x65\x69\x64","\x6D\x61\x69\x6C","\x66\x69\x6E\x64","\x73\x74\x6F\x70","\x6D\x65\x6D\x62\x65\x72\x6E\x61\x6D\x65","\x73\x65\x6E\x64","\x70\x72\x6F\x63\x65\x73\x73","\x74\x68\x65\x6E","\x6D\x65\x6D\x62\x65\x72\x69\x64","\x59\x59\x59\x59\x2D\x4D\x4D\x2D\x44\x44\x20\x48\x48\x3A\x6D\x6D\x3A\x73\x73","\x66\x6F\x72\x6D\x61\x74","\x75\x6E\x69\x71\x75\x65\x69\x64","\x75\x70\x64\x61\x74\x65","\x72\x65\x6A\x65\x63\x74\x65\x64\x41\x74","\x72\x65\x6A\x65\x63\x74","\x61\x66\x74\x65\x72\x55\x70\x64\x61\x74\x65","\x69\x6E\x52\x65\x70\x6C\x79\x54\x6F","\x6D\x61\x69\x6C\x4D\x65\x73\x73\x61\x67\x65\x41\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\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","\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","\x69\x64","\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","\x73\x75\x62\x6A\x65\x63\x74","\x66\x72\x6F\x6D","\x61\x64\x64\x72\x65\x73\x73","\x6D\x61\x70","\x74\x6F","\x63\x63","\x62\x63\x63","\x74\x65\x78\x74","\x68\x74\x6D\x6C","\x6E\x61\x6D\x65","\x6D\x61\x69\x6C\x49\x6E","\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","\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","\x64\x61\x74\x61\x56\x61\x6C\x75\x65\x73","\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","\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","\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","\x70\x69\x64","\x6B\x69\x6C\x6C","\x72\x65\x6D\x6F\x76\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x4D\x61\x69\x6C\x20\x61\x63\x63\x6F\x75\x6E\x74\x3A\x20","\x20\x55\x70\x64\x61\x74\x65","\x6D\x65\x72\x67\x65","\x75\x6E\x73\x68\x69\x66\x74","\x65\x78\x69\x74","\x72\x6F\x6F\x6D\x69\x64","\x63\x72\x65\x61\x74\x65\x4D\x61\x69\x6C","\x63\x72\x65\x61\x74\x65\x53\x6D\x73","\x2F\x73\x65\x72\x76\x65\x72\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x66\x6F\x72\x6B\x65\x64\x5F\x72\x6F\x75\x74\x69\x6E\x67\x2F\x6D\x61\x69\x6C\x2F\x69\x6E\x64\x65\x78\x2E\x6A\x73","\x73\x74\x61\x72\x74","\x25\x73\x2E\x25\x73","\x75\x6E\x69\x78","\x65\x78\x70\x6F\x72\x74\x73","\x75\x73\x65\x72\x6E\x61\x6D\x65","\x61\x63\x63\x6F\x75\x6E\x74\x69\x64","\x4D\x61\x69\x6C\x41\x63\x63\x6F\x75\x6E\x74\x49\x64","\x66\x69\x6E\x64\x41\x6C\x6C","\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"];_0x6711[0];const _=require(_0x6711[1]);const util=require(_0x6711[2]);const path=require(_0x6711[3]);const cp=require(_0x6711[4]);const ms=require(_0x6711[6])[_0x6711[5]];const msg=require(_0x6711[6])[_0x6711[7]];const Room=require(_0x6711[6])[_0x6711[8]];const Report=require(_0x6711[6])[_0x6711[9]];const Status=require(_0x6711[6])[_0x6711[10]];const Session=require(_0x6711[6])[_0x6711[11]];const Message=require(_0x6711[6])[_0x6711[7]];const SmsMessage=require(_0x6711[6])[_0x6711[12]];const Account=require(_0x6711[6])[_0x6711[13]];const Contact=require(_0x6711[6])[_0x6711[14]];const Company=require(_0x6711[6])[_0x6711[15]];const Attachment=require(_0x6711[6])[_0x6711[16]];const ReportMail=require(_0x6711[6])[_0x6711[9]];const ReportMailRoom=require(_0x6711[6])[_0x6711[17]];const ReportMailSession=require(_0x6711[6])[_0x6711[11]];const Promise=require(_0x6711[18]);const moment=require(_0x6711[19]);const open=Promise[_0x6711[22]](require(_0x6711[21])[_0x6711[20]]);const close=Promise[_0x6711[22]](require(_0x6711[21])[_0x6711[23]]);const write=Promise[_0x6711[22]](require(_0x6711[21])[_0x6711[24]]);const config=require(_0x6711[25]);var Util=require(_0x6711[26]);var processes=[];ReportMail[_0x6711[47]](function(_0x8a29x1c,_0x8a29x1d){var _0x8a29x1e=_0x8a29x1c[_0x6711[27]]({plain:true});if(_0x8a29x1c[_0x6711[29]](_0x6711[28])){return Session[_0x6711[44]]({memberid:_0x8a29x1e[_0x6711[40]],membername:_0x8a29x1e[_0x6711[36]],leaveAt:moment()[_0x6711[42]](_0x6711[41])},{where:{uniqueid:_0x8a29x1e[_0x6711[43]],leaveAt:null},individualHooks:true})[_0x6711[39]](function(){var _0x8a29x20=_[_0x6711[34]](processes,{id:_0x8a29x1e[_0x6711[32]],channel:_0x6711[33]});if(_0x8a29x20){_0x8a29x20[_0x6711[38]][_0x6711[37]]({type:_0x6711[35],membername:_0x8a29x1e[_0x6711[36]]})}})[_0x6711[31]](function(_0x8a29x1f){console[_0x6711[30]](_0x8a29x1f)})}else {if(_0x8a29x1c[_0x6711[29]](_0x6711[45])){var _0x8a29x20=_[_0x6711[34]](processes,{id:_0x8a29x1e[_0x6711[32]],channel:_0x6711[33]});if(_0x8a29x20){_0x8a29x20[_0x6711[38]][_0x6711[37]]({type:_0x6711[46],id:_0x8a29x1e[_0x6711[40]],membername:_0x8a29x1e[_0x6711[36]]})}}}});function handleMessage(msg,_0x8a29x22){var _0x8a29x23;var _0x8a29x24;var _0x8a29x25;var _0x8a29x26;var _0x8a29x27;var _0x8a29x28,_0x8a29x29,_0x8a29x2a,_0x8a29x2b;if(msg[_0x6711[48]]){return Message[_0x6711[92]]({where:{messageId:msg[_0x6711[48]][0],accountId:msg[_0x6711[93]]}})[_0x6711[39]](function(_0x8a29x35){if(_0x8a29x35){return _0x8a29x35[_0x6711[98]]()[_0x6711[39]](function(_0x8a29x34){_0x8a29x23= _0x8a29x34;if(_0x8a29x34[_0x6711[85]]!== _0x6711[86]){return _0x8a29x23[_0x6711[44]]({status:_0x6711[95],openReason:_0x6711[96],waiting:true},{individualHooks:true})[_0x6711[39]](function(){return Account[_0x6711[94]](msg[_0x6711[93]])[_0x6711[39]](function(_0x8a29x37){_0x8a29x25= _0x8a29x37;if(_0x8a29x25[_0x6711[88]]){return Company[_0x6711[92]]({where:{emailDomain:msg[_0x6711[75]][0][_0x6711[76]][_0x6711[90]](_0x6711[89])[1]}})[_0x6711[39]](function(_0x8a29x38){return Contact[_0x6711[91]]({where:{email:msg[_0x6711[75]][0][_0x6711[76]]},defaults:{email:msg[_0x6711[75]][0][_0x6711[76]],firstName:msg[_0x6711[75]][0][_0x6711[83]]|| msg[_0x6711[75]][0][_0x6711[76]][_0x6711[90]](_0x6711[89])[0],ListId:_0x8a29x25[_0x6711[88]],CompanyId:_0x8a29x38?_0x8a29x38[_0x6711[67]]:null}})})}else {return []}})[_0x6711[87]](function(_0x8a29x36){_0x8a29x26= _0x8a29x36})})}else {return Account[_0x6711[94]](msg[_0x6711[93]])[_0x6711[39]](function(_0x8a29x37){_0x8a29x25= _0x8a29x37;if(_0x8a29x25[_0x6711[88]]){return Company[_0x6711[92]]({where:{emailDomain:msg[_0x6711[75]][0][_0x6711[76]][_0x6711[90]](_0x6711[89])[1]}})[_0x6711[39]](function(_0x8a29x38){return Contact[_0x6711[91]]({where:{email:msg[_0x6711[75]][0][_0x6711[76]]},defaults:{email:msg[_0x6711[75]][0][_0x6711[76]],firstName:msg[_0x6711[75]][0][_0x6711[83]]|| msg[_0x6711[75]][0][_0x6711[76]][_0x6711[90]](_0x6711[89])[0],ListId:_0x8a29x25[_0x6711[88]],CompanyId:_0x8a29x38?_0x8a29x38[_0x6711[67]]:null}})})}else {return []}})[_0x6711[87]](function(_0x8a29x36){_0x8a29x26= _0x8a29x36;return Room[_0x6711[68]]({subject:msg[_0x6711[74]],from:_[_0x6711[77]](msg[_0x6711[75]],_0x6711[76])[_0x6711[65]](_0x6711[97]),account:_0x8a29x25[_0x6711[83]],attachment:msg[_0x6711[50]]&& msg[_0x6711[50]][_0x6711[51]],lastEvent:_0x6711[73],lastEventAt:moment()[_0x6711[42]](_0x6711[41]),arrivedAt:moment()[_0x6711[42]](_0x6711[41]),waiting:true,MailAccountId:_0x8a29x25[_0x6711[67]],ParentId:_0x8a29x34[_0x6711[67]]})})[_0x6711[39]](function(_0x8a29x34){_0x8a29x23= _0x8a29x34})}})}else {return Account[_0x6711[94]](msg[_0x6711[93]])[_0x6711[39]](function(_0x8a29x37){_0x8a29x25= _0x8a29x37;if(_0x8a29x25[_0x6711[88]]){return Company[_0x6711[92]]({where:{emailDomain:msg[_0x6711[75]][0][_0x6711[76]][_0x6711[90]](_0x6711[89])[1]}})[_0x6711[39]](function(_0x8a29x38){return Contact[_0x6711[91]]({where:{email:msg[_0x6711[75]][0][_0x6711[76]]},defaults:{email:msg[_0x6711[75]][0][_0x6711[76]],firstName:msg[_0x6711[75]][0][_0x6711[83]]|| msg[_0x6711[75]][0][_0x6711[76]][_0x6711[90]](_0x6711[89])[0],ListId:_0x8a29x25[_0x6711[88]],CompanyId:_0x8a29x38?_0x8a29x38[_0x6711[67]]:null}})})}else {return []}})[_0x6711[87]](function(_0x8a29x36){_0x8a29x26= _0x8a29x36;return Room[_0x6711[68]]({subject:msg[_0x6711[74]],from:_[_0x6711[77]](msg[_0x6711[75]],_0x6711[76])[_0x6711[65]](_0x6711[97]),account:_0x8a29x25[_0x6711[83]],attachment:msg[_0x6711[50]]&& msg[_0x6711[50]][_0x6711[51]],lastEvent:_0x6711[73],waiting:true,lastEventAt:moment()[_0x6711[42]](_0x6711[41]),arrivedAt:moment()[_0x6711[42]](_0x6711[41]),MailAccountId:_0x8a29x25[_0x6711[67]]})})[_0x6711[39]](function(_0x8a29x34){_0x8a29x23= _0x8a29x34})}})[_0x6711[39]](function(){return _0x8a29x23[_0x6711[44]]({lastEvent:_0x6711[73],mailIn:++_0x8a29x23[_0x6711[84]]})})[_0x6711[39]](function(_0x8a29x34){return Message[_0x6711[68]]({fromId:_0x8a29x26?_0x8a29x26[_0x6711[67]]:null,messageId:msg[_0x6711[72]],status:_0x6711[73],subject:msg[_0x6711[74]],from:_[_0x6711[77]](msg[_0x6711[75]],_0x6711[76]),to:msg[_0x6711[78]]?_[_0x6711[77]](msg[_0x6711[78]],_0x6711[76]):[],cc:msg[_0x6711[79]]?_[_0x6711[77]](msg[_0x6711[79]],_0x6711[76]):[],bcc:msg[_0x6711[80]]?_[_0x6711[77]](msg[_0x6711[80]],_0x6711[76]):[],text:msg[_0x6711[81]]|| null,html:msg[_0x6711[82]]|| null,MailRoomId:_0x8a29x23[_0x6711[67]],accountName:_0x8a29x25[_0x6711[83]],accountId:_0x8a29x25[_0x6711[67]],inReplyTo:msg[_0x6711[48]][0]})})[_0x6711[39]](function(_0x8a29x2c){var _0x8a29x2d=[];var _0x8a29x2e=_0x8a29x2c;_0x8a29x22[_0x6711[37]]({message:_0x6711[49],doc:_0x8a29x2c});createAndStartRouting(_0x8a29x23,msg,_0x8a29x2c[_0x6711[27]]({plain:true}),_0x8a29x25);if(msg[_0x6711[50]]&& msg[_0x6711[50]][_0x6711[51]]){msg[_0x6711[50]][_0x6711[70]](function(_0x8a29x2f){var _0x8a29x30=_0x6711[52]+ Math[_0x6711[53]](32);var _0x8a29x31;_0x8a29x2d[_0x6711[69]](Attachment[_0x6711[68]]({name:_0x8a29x2f[_0x6711[55]],basename:_0x8a29x30,path:path[_0x6711[65]](config[_0x6711[61]],_0x6711[62],_0x6711[63],_0x6711[50],_0x6711[64],_0x8a29x30),type:_0x8a29x2f[_0x6711[66]],size:_0x8a29x2f[_0x6711[51]],MailMessageId:_0x8a29x2e[_0x6711[67]]})[_0x6711[39]](function(_0x8a29x33){return open(_0x8a29x33[_0x6711[3]],_0x6711[60])})[_0x6711[39]](function(_0x8a29x32){_0x8a29x31= _0x8a29x32;return write(_0x8a29x31, new Buffer(_0x8a29x2f[_0x6711[59]][_0x6711[58]]),0,_0x8a29x2f[_0x6711[51]])})[_0x6711[39]](function(){return close(_0x8a29x31)})[_0x6711[39]](function(){console[_0x6711[57]](_0x6711[54],_0x8a29x2f[_0x6711[55]],_0x6711[56])})[_0x6711[31]](function(_0x8a29x1f){console[_0x6711[30]](_0x8a29x1f)}))})};return Promise[_0x6711[71]](_0x8a29x2d)})[_0x6711[31]](function(_0x8a29x1f){console[_0x6711[30]](_0x8a29x1f)})}else {return Account[_0x6711[94]](msg[_0x6711[93]])[_0x6711[39]](function(_0x8a29x37){_0x8a29x25= _0x8a29x37;if(_0x8a29x25[_0x6711[88]]){return Company[_0x6711[92]]({where:{emailDomain:msg[_0x6711[75]][0][_0x6711[76]][_0x6711[90]](_0x6711[89])[1]}})[_0x6711[39]](function(_0x8a29x38){return Contact[_0x6711[91]]({where:{email:msg[_0x6711[75]][0][_0x6711[76]]},defaults:{email:msg[_0x6711[75]][0][_0x6711[76]],firstName:msg[_0x6711[75]][0][_0x6711[83]]|| msg[_0x6711[75]][0][_0x6711[76]][_0x6711[90]](_0x6711[89])[0],ListId:_0x8a29x25[_0x6711[88]],CompanyId:_0x8a29x38?_0x8a29x38[_0x6711[67]]:null}})})}else {return []}})[_0x6711[87]](function(_0x8a29x36){_0x8a29x26= _0x8a29x36;return Room[_0x6711[68]]({mailIn:1,account:_0x8a29x25[_0x6711[83]],subject:msg[_0x6711[74]],from:_[_0x6711[77]](msg[_0x6711[75]],_0x6711[76])[_0x6711[65]](_0x6711[97]),status:_0x6711[100],lastEvent:_0x6711[73],lastEventAt:moment()[_0x6711[42]](_0x6711[41]),arrivedAt:moment()[_0x6711[42]](_0x6711[41]),attachment:msg[_0x6711[50]]&& msg[_0x6711[50]][_0x6711[51]],waiting:true,MailMessages:[{messageId:msg[_0x6711[72]],subject:msg[_0x6711[74]],from:_[_0x6711[77]](msg[_0x6711[75]],_0x6711[76]),fromId:_0x8a29x26?_0x8a29x26[_0x6711[67]]:null,to:msg[_0x6711[78]]?_[_0x6711[77]](msg[_0x6711[78]],_0x6711[76]):[],cc:msg[_0x6711[79]]?_[_0x6711[77]](msg[_0x6711[79]],_0x6711[76]):[],bcc:msg[_0x6711[80]]?_[_0x6711[77]](msg[_0x6711[80]],_0x6711[76]):[],status:_0x6711[73],text:msg[_0x6711[81]]|| null,html:msg[_0x6711[82]]|| null,accountName:_0x8a29x25[_0x6711[83]],accountId:_0x8a29x25[_0x6711[67]]}],MailAccountId:msg[_0x6711[93]]},{include:[{model:Message}]})})[_0x6711[39]](function(_0x8a29x39){var _0x8a29x2d=[];var _0x8a29x3a=_0x8a29x39;_0x8a29x22[_0x6711[37]]({message:_0x6711[49],doc:_0x8a29x39[_0x6711[99]][0]});createAndStartRouting(_0x8a29x3a,msg,_0x8a29x3a[_0x6711[99]][0][_0x6711[27]]({plain:true}),_0x8a29x25);if(msg[_0x6711[50]]&& msg[_0x6711[50]][_0x6711[51]]){msg[_0x6711[50]][_0x6711[70]](function(_0x8a29x2f){var _0x8a29x30=_0x6711[52]+ Math[_0x6711[53]](32);var _0x8a29x31;_0x8a29x2d[_0x6711[69]](Attachment[_0x6711[68]]({name:_0x8a29x2f[_0x6711[55]],basename:_0x8a29x30,path:path[_0x6711[65]](config[_0x6711[61]],_0x6711[62],_0x6711[63],_0x6711[50],_0x6711[64],_0x8a29x30),type:_0x8a29x2f[_0x6711[66]],size:_0x8a29x2f[_0x6711[51]],MailMessageId:_0x8a29x3a[_0x6711[99]][0][_0x6711[67]]})[_0x6711[39]](function(_0x8a29x33){return open(_0x8a29x33[_0x6711[3]],_0x6711[60])})[_0x6711[39]](function(_0x8a29x32){_0x8a29x31= _0x8a29x32;return write(_0x8a29x31, new Buffer(_0x8a29x2f[_0x6711[59]][_0x6711[58]]),0,_0x8a29x2f[_0x6711[51]])})[_0x6711[39]](function(){return close(_0x8a29x31)})[_0x6711[39]](function(){console[_0x6711[57]](_0x6711[54],_0x8a29x2f[_0x6711[55]],_0x6711[56])})[_0x6711[31]](function(_0x8a29x1f){console[_0x6711[30]](_0x8a29x1f)}))})};return Promise[_0x6711[71]](_0x8a29x2d)})[_0x6711[31]](function(_0x8a29x1f){console[_0x6711[30]](_0x8a29x1f)})}}function handleState(_0x8a29x3c,_0x8a29x1e){return ms[_0x6711[94]](_0x8a29x3c)[_0x6711[39]](function(_0x8a29x3d){return _0x8a29x3d[_0x6711[44]]({state:_0x8a29x1e[_0x6711[101]],source:_0x8a29x1e[_0x6711[102]]|| null})})[_0x6711[31]](function(_0x8a29x1f){console[_0x6711[30]](_0x8a29x1f)})}function fork(_0x8a29x3c,_0x8a29x3f,_0x8a29x22){return cp[_0x6711[109]](__dirname+ _0x6711[108],[_0x8a29x3c,_0x8a29x3f])[_0x6711[103]](_0x6711[105],function(_0x8a29x1e){switch(_0x8a29x1e[_0x6711[107]]){case _0x6711[106]:handleMessage(_0x8a29x1e,_0x8a29x22);break;case _0x6711[101]:handleState(_0x8a29x3c,_0x8a29x1e);break;default:}})[_0x6711[103]](_0x6711[23],function(_0x8a29x40){console[_0x6711[57]](util[_0x6711[42]](_0x6711[104],_0x8a29x3f,_0x8a29x40))})[_0x6711[103]](_0x6711[30],function(_0x8a29x1f){console[_0x6711[30]](_0x8a29x1f)})}function execRequest(_0x8a29x1c,_0x8a29x42,_0x8a29x43){Util[_0x6711[112]](_0x8a29x1c,_0x8a29x42,_0x8a29x43)[_0x6711[39]](function(_0x8a29x44){console[_0x6711[57]](_0x6711[111])})[_0x6711[31]](function(_0x8a29x1f){console[_0x6711[57]](_0x6711[110])})}function webhook(_0x8a29x1c,_0x8a29x46,_0x8a29x47){var _0x8a29x48=_0x8a29x46;switch(_0x8a29x47){case _0x6711[121]:if(_0x8a29x48[_0x6711[113]]&& _0x8a29x48[_0x6711[114]]){console[_0x6711[57]](_0x6711[115]+ _0x8a29x48[_0x6711[83]]+ _0x6711[116]);execRequest(_0x8a29x1c[_0x6711[117]],_0x8a29x48[_0x6711[113]],_0x8a29x48[_0x6711[114]])};if(_0x8a29x48[_0x6711[118]][_0x6711[51]]){_[_0x6711[70]](_0x8a29x48[_0x6711[118]],function(_0x8a29x49){if(_0x8a29x49[_0x6711[119]]){Util[_0x6711[120]](_0x8a29x49,_0x8a29x1c)}})};break;case _0x6711[46]:if(_0x8a29x48[_0x6711[122]]&& _0x8a29x48[_0x6711[123]]){console[_0x6711[57]](_0x6711[115]+ _0x8a29x48[_0x6711[83]]+ _0x6711[124]);execRequest(_0x8a29x1c[_0x6711[117]],_0x8a29x48[_0x6711[122]],_0x8a29x48[_0x6711[123]])};break;case _0x6711[23]:if(_0x8a29x48[_0x6711[125]]&& _0x8a29x48[_0x6711[126]]){console[_0x6711[57]](_0x6711[115]+ _0x8a29x48[_0x6711[83]]+ _0x6711[127]);execRequest(_0x8a29x1c[_0x6711[117]],_0x8a29x48[_0x6711[125]],_0x8a29x48[_0x6711[126]])};break;default:console[_0x6711[57]](_0x6711[128])}}function synch(_0x8a29x4b,_0x8a29x4c){Account[_0x6711[133]](function(_0x8a29x1c){var _0x8a29x46=_[_0x6711[34]](_0x8a29x4b,{id:_0x8a29x1c[_0x6711[67]]});if(_0x8a29x46&& _0x8a29x46[_0x6711[5]]){if(_0x8a29x4c[_0x8a29x46[_0x6711[5]][_0x6711[67]]]){console[_0x6711[57]](util[_0x6711[42]](_0x6711[129],_0x8a29x46[_0x6711[5]][_0x6711[67]],_0x8a29x4c[_0x8a29x46[_0x6711[5]][_0x6711[67]]][_0x6711[130]]));_0x8a29x4c[_0x8a29x46[_0x6711[5]][_0x6711[67]]][_0x6711[131]]();_0x8a29x4c[_0x8a29x46[_0x6711[5]][_0x6711[67]]]= null};_[_0x6711[132]](_0x8a29x4b,{id:_0x8a29x1c[_0x6711[67]]})}});Account[_0x6711[134]](function(_0x8a29x1c){_0x8a29x4b[_0x6711[69]](_0x8a29x1c)});Account[_0x6711[47]](function(_0x8a29x1c){var _0x8a29x4d=_[_0x6711[34]](_0x8a29x4b,{id:_0x8a29x1c[_0x6711[67]]});if(_0x8a29x4d){console[_0x6711[57]](_0x6711[135]+ _0x8a29x4d[_0x6711[83]]+ _0x6711[136]);_[_0x6711[137]](_0x8a29x4d,_0x8a29x1c)}else {_0x8a29x4b[_0x6711[138]](_0x8a29x1c)}})}function createAndStartRouting(_0x8a29x39,_0x8a29x4f,_0x8a29x2c,_0x8a29x46){var _0x8a29x50=cp[_0x6711[109]](path[_0x6711[65]](config[_0x6711[61]],_0x6711[143]))[_0x6711[103]](_0x6711[105],function(msg){switch(msg[_0x6711[107]]){case _0x6711[141]:return Message[_0x6711[68]](msg[_0x6711[106]],{include:[{model:Attachment}]});case _0x6711[142]:return SmsMessage[_0x6711[68]](msg[_0x6711[106]]);default:}})[_0x6711[103]](_0x6711[139],function(){var _0x8a29x51=_[_0x6711[132]](processes,{pid:this[_0x6711[130]]});if(_0x8a29x51&& _0x8a29x51[_0x6711[51]]){return Room[_0x6711[94]](_0x8a29x51[0][_0x6711[140]])[_0x6711[39]](function(_0x8a29x39){if(_0x8a29x39){return _0x8a29x39[_0x6711[44]]({waiting:false})}})}});_0x8a29x50[_0x6711[37]]({type:_0x6711[144],param1:{channel:_0x6711[33],uniqueid:util[_0x6711[42]](_0x6711[145],moment()[_0x6711[146]](),_0x8a29x39[_0x6711[67]]),subject:_0x8a29x4f[_0x6711[74]],messageid:_0x8a29x2c[_0x6711[67]],roomid:_0x8a29x39[_0x6711[67]],accountid:_0x8a29x46[_0x6711[67]],accountname:_0x8a29x46[_0x6711[83]],accountaddress:_0x8a29x46[_0x6711[76]],from:_0x8a29x4f[_0x6711[75]][0][_0x6711[76]],cc:_0x8a29x4f[_0x6711[79]]?_[_0x6711[77]](_0x8a29x4f[_0x6711[79]],_0x6711[76]):[]},param2:_0x8a29x2c});processes[_0x6711[69]]({id:_0x8a29x2c[_0x6711[67]],channel:_0x6711[33],process:_0x8a29x50,roomid:_0x8a29x39[_0x6711[67]],pid:_0x8a29x50[_0x6711[130]]})}module[_0x6711[147]]= function(_0x8a29x22){var _0x8a29x4c={};var _0x8a29x4b;var _0x8a29x52;process[_0x6711[103]](_0x6711[139],function(_0x8a29x40){for(var _0x8a29x53 in _0x8a29x4c){if(_0x8a29x4c[_0x8a29x53]){_0x8a29x4c[_0x8a29x53][_0x6711[131]]()}}});Account[_0x6711[151]]({include:[ms]})[_0x6711[39]](function(_0x8a29x54){_0x8a29x4b= _0x8a29x54;synch(_0x8a29x4b,_0x8a29x4c);_0x8a29x4b[_0x6711[70]](function(_0x8a29x46){if(_0x8a29x46[_0x6711[5]]){_0x8a29x4c[_0x8a29x46[_0x6711[5]][_0x6711[67]]]= fork(_0x8a29x46[_0x6711[5]][_0x6711[67]],_0x8a29x46[_0x6711[5]][_0x6711[148]],_0x8a29x22)}});ReportMail[_0x6711[47]](function(_0x8a29x1c){var _0x8a29x46=_[_0x6711[34]](_0x8a29x4b,{id:parseInt(_0x8a29x1c[_0x6711[149]])});if(_0x8a29x46&& _0x8a29x1c[_0x6711[29]](_0x6711[28])){webhook(_0x8a29x1c,_0x8a29x46,_0x6711[121])};if(_0x8a29x46&& _0x8a29x1c[_0x6711[29]](_0x6711[45])){webhook(_0x8a29x1c,_0x8a29x46,_0x6711[46])}});Room[_0x6711[47]](function(_0x8a29x1c){var _0x8a29x46=_[_0x6711[34]](_0x8a29x4b,{id:_0x8a29x1c[_0x6711[150]]});if(_0x8a29x46&& _0x8a29x1c[_0x6711[29]](_0x6711[85])&& _0x8a29x1c[_0x6711[85]]=== _0x6711[86]){webhook(_0x8a29x1c,_0x8a29x46,_0x6711[23])}})})[_0x6711[31]](function(_0x8a29x1f){console[_0x6711[30]](_0x8a29x1f)});ms[_0x6711[134]](function(_0x8a29x3d){var _0x8a29x46=_[_0x6711[34]](_0x8a29x4b,{id:_0x8a29x3d[_0x6711[150]]});if(_0x8a29x46){_0x8a29x46[_0x6711[5]]= _0x8a29x3d};_0x8a29x4c[_0x8a29x3d[_0x6711[67]]]= fork(_0x8a29x3d[_0x6711[67]],_0x8a29x3d[_0x6711[148]],_0x8a29x22)});ms[_0x6711[47]](function(_0x8a29x3d){if(_0x8a29x4c[_0x8a29x3d[_0x6711[67]]]){if(_0x8a29x3d[_0x6711[29]](_0x6711[101])|| _0x8a29x3d[_0x6711[29]](_0x6711[102])){console[_0x6711[57]](util[_0x6711[42]](_0x6711[152],_0x8a29x3d[_0x6711[67]],_0x8a29x4c[_0x8a29x3d[_0x6711[67]]][_0x6711[130]]))}else {_0x8a29x4c[_0x8a29x3d[_0x6711[67]]][_0x6711[131]]();_0x8a29x4c[_0x8a29x3d[_0x6711[67]]]= null;_0x8a29x4c[_0x8a29x3d[_0x6711[67]]]= fork(_0x8a29x3d[_0x6711[67]],_0x8a29x3d[_0x6711[148]],_0x8a29x22)}}});ms[_0x6711[133]](function(_0x8a29x3d){if(_0x8a29x4c[_0x8a29x3d[_0x6711[67]]]){console[_0x6711[57]](util[_0x6711[42]](_0x6711[129],_0x8a29x3d[_0x6711[67]],_0x8a29x4c[_0x8a29x3d[_0x6711[67]]][_0x6711[130]]));_0x8a29x4c[_0x8a29x3d[_0x6711[67]]][_0x6711[131]]();_0x8a29x4c[_0x8a29x3d[_0x6711[67]]]= null}})}
\ No newline at end of file