Built motion from commit 27af9f03b.|1.0.28
[motion.git] / server / config / imap / index.js
index 98a5c33..ed3d47e 100644 (file)
@@ -1 +1 @@
-var _0xe27e=["\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\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","\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","\x69\x6E\x52\x65\x70\x6C\x79\x54\x6F","\x65\x72\x72\x6F\x72","\x63\x61\x74\x63\x68","\x2E\x2E\x2F\x72\x6F\x75\x74\x69\x6E\x67\x2F\x6D\x61\x69\x6C","\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","\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","\x6D\x61\x69\x6C\x49\x6E","\x75\x70\x64\x61\x74\x65","\x73\x74\x61\x74\x75\x73","\x43\x4C\x4F\x53\x45\x44","\x3B","\x6E\x61\x6D\x65","\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","\x67\x65\x74\x4D\x61\x69\x6C\x52\x6F\x6F\x6D","\x4D\x61\x69\x6C\x4D\x65\x73\x73\x61\x67\x65\x73","\x59\x59\x59\x59\x2D\x4D\x4D\x2D\x44\x44","\x66\x6F\x72\x6D\x61\x74","\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","\x65\x78\x70\x6F\x72\x74\x73","\x65\x78\x69\x74","\x6B\x69\x6C\x6C","\x75\x73\x65\x72\x6E\x61\x6D\x65","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x63\x68\x61\x6E\x67\x65\x64","\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","\x61\x66\x74\x65\x72\x55\x70\x64\x61\x74\x65","\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"];_0xe27e[0];const _=require(_0xe27e[1]);const util=require(_0xe27e[2]);const path=require(_0xe27e[3]);const cp=require(_0xe27e[4]);const ms=require(_0xe27e[6])[_0xe27e[5]];const msg=require(_0xe27e[6])[_0xe27e[7]];const Room=require(_0xe27e[6])[_0xe27e[8]];const Message=require(_0xe27e[6])[_0xe27e[7]];const Account=require(_0xe27e[6])[_0xe27e[9]];const Contact=require(_0xe27e[6])[_0xe27e[10]];const Company=require(_0xe27e[6])[_0xe27e[11]];const Attachment=require(_0xe27e[6])[_0xe27e[12]];const Promise=require(_0xe27e[13]);const moment=require(_0xe27e[14]);const open=Promise[_0xe27e[17]](require(_0xe27e[16])[_0xe27e[15]]);const close=Promise[_0xe27e[17]](require(_0xe27e[16])[_0xe27e[18]]);const write=Promise[_0xe27e[17]](require(_0xe27e[16])[_0xe27e[19]]);const config=require(_0xe27e[20]);function handleMessage(msg){var _0x70f3x14;var _0x70f3x15;var _0x70f3x16;var _0x70f3x17;var _0x70f3x18;var _0x70f3x19,_0x70f3x1a,_0x70f3x1b,_0x70f3x1c;if(msg[_0xe27e[21]]){return Message[_0xe27e[69]]({where:{messageId:msg[_0xe27e[21]][0]}})[_0xe27e[33]](function(_0x70f3x27){if(_0x70f3x27){return _0x70f3x27[_0xe27e[72]]()[_0xe27e[33]](function(_0x70f3x26){if(_0x70f3x26[_0xe27e[60]]!==_0xe27e[61]){return _0x70f3x26}else {return Account[_0xe27e[71]](msg[_0xe27e[70]])[_0xe27e[33]](function(_0x70f3x29){_0x70f3x16=_0x70f3x29;if(_0x70f3x16[_0xe27e[65]]){return Company[_0xe27e[69]]({where:{emailDomain:msg[_0xe27e[51]][0][_0xe27e[52]][_0xe27e[67]](_0xe27e[66])[1]}})[_0xe27e[33]](function(_0x70f3x2a){return Contact[_0xe27e[68]]({where:{email:msg[_0xe27e[51]][0][_0xe27e[52]]},defaults:{email:msg[_0xe27e[51]][0][_0xe27e[52]],firstName:msg[_0xe27e[51]][0][_0xe27e[63]]||msg[_0xe27e[51]][0][_0xe27e[52]][_0xe27e[67]](_0xe27e[66])[0],ListId:_0x70f3x16[_0xe27e[65]],CompanyId:_0x70f3x2a?_0x70f3x2a[_0xe27e[43]]:null}})})}else {return []}})[_0xe27e[64]](function(_0x70f3x28){_0x70f3x17=_0x70f3x28;return Room[_0xe27e[44]]({subject:msg[_0xe27e[50]],from:_[_0xe27e[53]](msg[_0xe27e[51]],_0xe27e[52])[_0xe27e[41]](_0xe27e[62]),account:_0x70f3x16[_0xe27e[63]],attachment:msg[_0xe27e[25]]&&msg[_0xe27e[25]][_0xe27e[26]],MailAccountId:_0x70f3x16[_0xe27e[43]],ParentId:_0x70f3x26[_0xe27e[43]]})})}})}else {return Account[_0xe27e[71]](msg[_0xe27e[70]])[_0xe27e[33]](function(_0x70f3x29){_0x70f3x16=_0x70f3x29;if(_0x70f3x16[_0xe27e[65]]){return Company[_0xe27e[69]]({where:{emailDomain:msg[_0xe27e[51]][0][_0xe27e[52]][_0xe27e[67]](_0xe27e[66])[1]}})[_0xe27e[33]](function(_0x70f3x2a){return Contact[_0xe27e[68]]({where:{email:msg[_0xe27e[51]][0][_0xe27e[52]]},defaults:{email:msg[_0xe27e[51]][0][_0xe27e[52]],firstName:msg[_0xe27e[51]][0][_0xe27e[63]]||msg[_0xe27e[51]][0][_0xe27e[52]][_0xe27e[67]](_0xe27e[66])[0],ListId:_0x70f3x16[_0xe27e[65]],CompanyId:_0x70f3x2a?_0x70f3x2a[_0xe27e[43]]:null}})})}else {return []}})[_0xe27e[64]](function(_0x70f3x28){_0x70f3x17=_0x70f3x28;return Room[_0xe27e[44]]({subject:msg[_0xe27e[50]],from:_[_0xe27e[53]](msg[_0xe27e[51]],_0xe27e[52])[_0xe27e[41]](_0xe27e[62]),account:_0x70f3x16[_0xe27e[63]],attachment:msg[_0xe27e[25]]&&msg[_0xe27e[25]][_0xe27e[26]],MailAccountId:_0x70f3x16[_0xe27e[43]]})})}})[_0xe27e[33]](function(_0x70f3x26){_0x70f3x14=_0x70f3x26;return _0x70f3x14[_0xe27e[59]]({lastEvent:_0xe27e[49],mailIn:++_0x70f3x14[_0xe27e[58]]})})[_0xe27e[33]](function(_0x70f3x26){return Message[_0xe27e[44]]({fromId:_0x70f3x17?_0x70f3x17[_0xe27e[43]]:null,messageId:msg[_0xe27e[48]],status:_0xe27e[49],subject:msg[_0xe27e[50]],from:_[_0xe27e[53]](msg[_0xe27e[51]],_0xe27e[52]),to:msg[_0xe27e[54]]?_[_0xe27e[53]](msg[_0xe27e[54]],_0xe27e[52]):[],cc:msg[_0xe27e[55]]?_[_0xe27e[53]](msg[_0xe27e[55]],_0xe27e[52]):[],bcc:msg[_0xe27e[56]]?_[_0xe27e[53]](msg[_0xe27e[56]],_0xe27e[52]):[],text:msg[_0xe27e[57]]||null,MailRoomId:_0x70f3x14[_0xe27e[43]]})})[_0xe27e[33]](function(_0x70f3x1e){require(_0xe27e[24])(_0x70f3x1e);var _0x70f3x1f=[];var _0x70f3x20=_0x70f3x1e;if(msg[_0xe27e[25]]&&msg[_0xe27e[25]][_0xe27e[26]]){msg[_0xe27e[25]][_0xe27e[46]](function(_0x70f3x21){var _0x70f3x22=_0xe27e[27]+Math[_0xe27e[28]](32);var _0x70f3x23;_0x70f3x1f[_0xe27e[45]](Attachment[_0xe27e[44]]({name:_0x70f3x21[_0xe27e[30]],basename:_0x70f3x22,path:path[_0xe27e[41]](config[_0xe27e[37]],_0xe27e[38],_0xe27e[39],_0xe27e[25],_0xe27e[40],_0x70f3x22),type:_0x70f3x21[_0xe27e[42]],size:_0x70f3x21[_0xe27e[26]],MailMessageId:_0x70f3x20[_0xe27e[43]]})[_0xe27e[33]](function(_0x70f3x25){return open(_0x70f3x25[_0xe27e[3]],_0xe27e[36])})[_0xe27e[33]](function(_0x70f3x24){_0x70f3x23=_0x70f3x24;return write(_0x70f3x23, new Buffer(_0x70f3x21[_0xe27e[35]][_0xe27e[34]]),0,_0x70f3x21[_0xe27e[26]])})[_0xe27e[33]](function(){return close(_0x70f3x23)})[_0xe27e[33]](function(){console[_0xe27e[32]](_0xe27e[29],_0x70f3x21[_0xe27e[30]],_0xe27e[31])})[_0xe27e[23]](function(_0x70f3x1d){console[_0xe27e[22]](_0x70f3x1d)}))})};return Promise[_0xe27e[47]](_0x70f3x1f)})[_0xe27e[23]](function(_0x70f3x1d){console[_0xe27e[22]](_0x70f3x1d)})}else {return Account[_0xe27e[71]](msg[_0xe27e[70]])[_0xe27e[33]](function(_0x70f3x29){_0x70f3x16=_0x70f3x29;if(_0x70f3x16[_0xe27e[65]]){return Company[_0xe27e[69]]({where:{emailDomain:msg[_0xe27e[51]][0][_0xe27e[52]][_0xe27e[67]](_0xe27e[66])[1]}})[_0xe27e[33]](function(_0x70f3x2a){return Contact[_0xe27e[68]]({where:{email:msg[_0xe27e[51]][0][_0xe27e[52]]},defaults:{email:msg[_0xe27e[51]][0][_0xe27e[52]],firstName:msg[_0xe27e[51]][0][_0xe27e[63]]||msg[_0xe27e[51]][0][_0xe27e[52]][_0xe27e[67]](_0xe27e[66])[0],ListId:_0x70f3x16[_0xe27e[65]],CompanyId:_0x70f3x2a?_0x70f3x2a[_0xe27e[43]]:null}})})}else {return []}})[_0xe27e[64]](function(_0x70f3x28){_0x70f3x17=_0x70f3x28;return Room[_0xe27e[44]]({mailIn:1,account:_0x70f3x16[_0xe27e[63]],subject:msg[_0xe27e[50]],from:_[_0xe27e[53]](msg[_0xe27e[51]],_0xe27e[52])[_0xe27e[41]](_0xe27e[62]),lastEvent:_0xe27e[49],lastEventAt:moment()[_0xe27e[75]](_0xe27e[74]),attachment:msg[_0xe27e[25]]&&msg[_0xe27e[25]][_0xe27e[26]],MailMessages:[{messageId:msg[_0xe27e[48]],subject:msg[_0xe27e[50]],from:_[_0xe27e[53]](msg[_0xe27e[51]],_0xe27e[52]),fromId:_0x70f3x17?_0x70f3x17[_0xe27e[43]]:null,to:msg[_0xe27e[54]]?_[_0xe27e[53]](msg[_0xe27e[54]],_0xe27e[52]):[],cc:msg[_0xe27e[55]]?_[_0xe27e[53]](msg[_0xe27e[55]],_0xe27e[52]):[],bcc:msg[_0xe27e[56]]?_[_0xe27e[53]](msg[_0xe27e[56]],_0xe27e[52]):[],status:_0xe27e[49],text:msg[_0xe27e[57]]||null}],MailAccountId:msg[_0xe27e[70]]},{include:[{model:Message}]})})[_0xe27e[33]](function(_0x70f3x2b){var _0x70f3x1f=[];var _0x70f3x2c=_0x70f3x2b;require(_0xe27e[24])(_0x70f3x2c[_0xe27e[73]][0]);if(msg[_0xe27e[25]]&&msg[_0xe27e[25]][_0xe27e[26]]){msg[_0xe27e[25]][_0xe27e[46]](function(_0x70f3x21){var _0x70f3x22=_0xe27e[27]+Math[_0xe27e[28]](32);var _0x70f3x23;_0x70f3x1f[_0xe27e[45]](Attachment[_0xe27e[44]]({name:_0x70f3x21[_0xe27e[30]],basename:_0x70f3x22,path:path[_0xe27e[41]](config[_0xe27e[37]],_0xe27e[38],_0xe27e[39],_0xe27e[25],_0xe27e[40],_0x70f3x22),type:_0x70f3x21[_0xe27e[42]],size:_0x70f3x21[_0xe27e[26]],MailMessageId:_0x70f3x2c[_0xe27e[73]][0][_0xe27e[43]]})[_0xe27e[33]](function(_0x70f3x25){return open(_0x70f3x25[_0xe27e[3]],_0xe27e[36])})[_0xe27e[33]](function(_0x70f3x24){_0x70f3x23=_0x70f3x24;return write(_0x70f3x23, new Buffer(_0x70f3x21[_0xe27e[35]][_0xe27e[34]]),0,_0x70f3x21[_0xe27e[26]])})[_0xe27e[33]](function(){return close(_0x70f3x23)})[_0xe27e[33]](function(){console[_0xe27e[32]](_0xe27e[29],_0x70f3x21[_0xe27e[30]],_0xe27e[31])})[_0xe27e[23]](function(_0x70f3x1d){console[_0xe27e[22]](_0x70f3x1d)}))})};return Promise[_0xe27e[47]](_0x70f3x1f)})[_0xe27e[23]](function(_0x70f3x1d){console[_0xe27e[22]](_0x70f3x1d)})}}function handleState(_0x70f3x2e,_0x70f3x2f){return ms[_0xe27e[71]](_0x70f3x2e)[_0xe27e[33]](function(_0x70f3x30){return _0x70f3x30[_0xe27e[59]]({state:_0x70f3x2f[_0xe27e[76]],source:_0x70f3x2f[_0xe27e[77]]||null})})[_0xe27e[23]](function(_0x70f3x1d){console[_0xe27e[22]](_0x70f3x1d)})}function fork(_0x70f3x2e,_0x70f3x32){return cp[_0xe27e[84]](__dirname+_0xe27e[83],[_0x70f3x2e,_0x70f3x32])[_0xe27e[78]](_0xe27e[80],function(_0x70f3x2f){switch(_0x70f3x2f[_0xe27e[82]]){case _0xe27e[81]:handleMessage(_0x70f3x2f);break;case _0xe27e[76]:handleState(_0x70f3x2e,_0x70f3x2f);break;default:}})[_0xe27e[78]](_0xe27e[18],function(_0x70f3x33){console[_0xe27e[32]](util[_0xe27e[75]](_0xe27e[79],_0x70f3x32,_0x70f3x33))})[_0xe27e[78]](_0xe27e[22],function(_0x70f3x1d){console[_0xe27e[22]](_0x70f3x1d)})}module[_0xe27e[85]]=function(){var _0x70f3x34={};var _0x70f3x35;process[_0xe27e[78]](_0xe27e[86],function(_0x70f3x33){for(var _0x70f3x36 in _0x70f3x34){if(_0x70f3x34[_0x70f3x36]){_0x70f3x34[_0x70f3x36][_0xe27e[87]]()}}});ms[_0xe27e[89]](function(_0x70f3x30){_0x70f3x34[_0x70f3x30[_0xe27e[43]]]=fork(_0x70f3x30[_0xe27e[43]],_0x70f3x30[_0xe27e[88]])});ms[_0xe27e[94]](function(_0x70f3x30){if(_0x70f3x34[_0x70f3x30[_0xe27e[43]]]){if(_0x70f3x30[_0xe27e[90]](_0xe27e[76])||_0x70f3x30[_0xe27e[90]](_0xe27e[77])){console[_0xe27e[32]](util[_0xe27e[75]](_0xe27e[91],_0x70f3x30[_0xe27e[43]],_0x70f3x34[_0x70f3x30[_0xe27e[43]]][_0xe27e[92]]));clearTimeout(_0x70f3x35);switch(_0x70f3x30[_0xe27e[76]]){case _0xe27e[93]:_0x70f3x35=setTimeout(function(){_0x70f3x34[_0x70f3x30[_0xe27e[43]]]=fork(_0x70f3x30[_0xe27e[43]],_0x70f3x30[_0xe27e[88]])},10000);break;default:}}else {_0x70f3x34[_0x70f3x30[_0xe27e[43]]][_0xe27e[87]]();_0x70f3x34[_0x70f3x30[_0xe27e[43]]]=null;_0x70f3x34[_0x70f3x30[_0xe27e[43]]]=fork(_0x70f3x30[_0xe27e[43]],_0x70f3x30[_0xe27e[88]])}}});ms[_0xe27e[96]](function(_0x70f3x30){if(_0x70f3x34[_0x70f3x30[_0xe27e[43]]]){console[_0xe27e[32]](util[_0xe27e[75]](_0xe27e[95],_0x70f3x30[_0xe27e[43]],_0x70f3x34[_0x70f3x30[_0xe27e[43]]][_0xe27e[92]]));_0x70f3x34[_0x70f3x30[_0xe27e[43]]][_0xe27e[87]]();_0x70f3x34[_0x70f3x30[_0xe27e[43]]]=null}});ms[_0xe27e[97]]()[_0xe27e[33]](function(_0x70f3x37){_0x70f3x37[_0xe27e[46]](function(_0x70f3x30){_0x70f3x34[_0x70f3x30[_0xe27e[43]]]=fork(_0x70f3x30[_0xe27e[43]],_0x70f3x30[_0xe27e[88]])})})[_0xe27e[23]](function(_0x70f3x1d){console[_0xe27e[22]](_0x70f3x1d)})}
\ No newline at end of file
+var _0x7e3a=["\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","\x6D\x6F\x6D\x65\x6E\x74","\x6B\x75\x65","\x62\x6C\x75\x65\x62\x69\x72\x64","\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","\x53\x65\x74\x74\x69\x6E\x67","\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","\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","\x6D\x61\x69\x6C","\x2E\x2E\x2F\x6C\x6F\x67\x67\x65\x72\x2E\x6A\x73","\x2E\x2E\x2F\x65\x6E\x76\x69\x72\x6F\x6E\x6D\x65\x6E\x74","\x2E\x2E\x2F\x75\x74\x69\x6C","\x63\x72\x65\x61\x74\x65\x51\x75\x65\x75\x65","\x67\x65\x74","\x63\x6F\x6E\x6E\x65\x63\x74\x69\x64","\x63\x68\x61\x6E\x67\x65\x64","\x45\x72\x72\x6F\x72\x20\x6F\x6E\x20\x6D\x61\x69\x6C\x20\x61\x63\x63\x65\x70\x74","\x65\x72\x72\x6F\x72","\x63\x61\x74\x63\x68","\x6D\x65\x73\x73\x61\x67\x65\x69\x64","\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","\x73\x74\x61\x63\x6B","\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","\x4D\x61\x69\x6C\x20\x68\x61\x6E\x64\x6C\x69\x6E\x67\x20\x65\x72\x72\x6F\x72","\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","\x64\x65\x62\x75\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","\x53\x65\x72\x76\x65\x72\x20\x73\x74\x61\x74\x65\x20\x65\x72\x72\x6F\x72\x3A","\x73\x74\x61\x74\x65","\x73\x6F\x75\x72\x63\x65","\x49\x4D\x41\x50\x20\x70\x72\x6F\x63\x65\x73\x73\x20\x65\x72\x72\x6F\x72","\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","\x69\x6E\x66\x6F","\x72\x65\x71\x75\x65\x73\x74\x20\x73\x75\x63\x63\x65\x65\x64\x65\x64\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","\x73\x61\x76\x65","\x72\x65\x6D\x6F\x76\x65\x4F\x6E\x43\x6F\x6D\x70\x6C\x65\x74\x65","\x65\x6D\x61\x69\x6C","\x4E\x65\x77\x20\x65\x6D\x61\x69\x6C\x20\x66\x72\x6F\x6D\x3A\x20\x25\x73","\x6D\x61\x69\x6C\x4D\x65\x73\x73\x61\x67\x65","\x72\x6F\x6F\x6D","\x61\x63\x63\x6F\x75\x6E\x74","\x64\x69\x73\x63\x6F\x6E\x6E\x65\x63\x74","\x65\x78\x69\x74","\x66\x69\x6E\x61\x6C\x6C\x79","\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","\x63\x72\x65\x61\x74\x65\x4D\x61\x69\x6C\x51\x75\x65\x75\x65\x53\x65\x73\x73\x69\x6F\x6E","\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","\x6D\x61\x69\x6C\x52\x6F\x75\x74\x69\x6E\x67\x43\x61\x70\x61\x63\x69\x74\x79","\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"];_0x7e3a[0];var _=require(_0x7e3a[1]);var util=require(_0x7e3a[2]);var path=require(_0x7e3a[3]);var cp=require(_0x7e3a[4]);var moment=require(_0x7e3a[5]);var kue=require(_0x7e3a[6]);var Promise=require(_0x7e3a[7]);var ms=require(_0x7e3a[9])[_0x7e3a[8]];var msg=require(_0x7e3a[9])[_0x7e3a[10]];var Room=require(_0x7e3a[9])[_0x7e3a[11]];var Report=require(_0x7e3a[9])[_0x7e3a[12]];var Status=require(_0x7e3a[9])[_0x7e3a[13]];var Session=require(_0x7e3a[9])[_0x7e3a[14]];var Message=require(_0x7e3a[9])[_0x7e3a[10]];var SmsMessage=require(_0x7e3a[9])[_0x7e3a[15]];var Account=require(_0x7e3a[9])[_0x7e3a[16]];var Setting=require(_0x7e3a[9])[_0x7e3a[17]];var Contact=require(_0x7e3a[9])[_0x7e3a[18]];var Company=require(_0x7e3a[9])[_0x7e3a[19]];var Attachment=require(_0x7e3a[9])[_0x7e3a[20]];var open=Promise[_0x7e3a[23]](require(_0x7e3a[22])[_0x7e3a[21]]);var close=Promise[_0x7e3a[23]](require(_0x7e3a[22])[_0x7e3a[24]]);var write=Promise[_0x7e3a[23]](require(_0x7e3a[22])[_0x7e3a[25]]);var logger=require(_0x7e3a[27])(_0x7e3a[26]);var config=require(_0x7e3a[28]);var Util=require(_0x7e3a[29]);var queue=kue[_0x7e3a[30]]();var processes=[];var ami;Report[_0x7e3a[51]](function(_0xf7acx1e,_0xf7acx1f){var _0xf7acx20=_0xf7acx1e[_0x7e3a[31]]({plain:true});if(_0xf7acx1e[_0x7e3a[33]](_0x7e3a[32])){return Session[_0x7e3a[48]]({memberid:_0xf7acx20[_0x7e3a[44]],membername:_0xf7acx20[_0x7e3a[40]],leaveAt:moment()[_0x7e3a[46]](_0x7e3a[45])},{where:{uniqueid:_0xf7acx20[_0x7e3a[47]],leaveAt:null},individualHooks:true})[_0x7e3a[43]](function(){var _0xf7acx22=_[_0x7e3a[38]](processes,{id:_0xf7acx20[_0x7e3a[37]],channel:_0x7e3a[26]});if(_0xf7acx22){_0xf7acx22[_0x7e3a[42]][_0x7e3a[41]]({type:_0x7e3a[39],membername:_0xf7acx20[_0x7e3a[40]]})}})[_0x7e3a[36]](function(_0xf7acx21){logger[_0x7e3a[35]](_0x7e3a[34],_0xf7acx21)})}else {if(_0xf7acx1e[_0x7e3a[33]](_0x7e3a[49])){var _0xf7acx22=_[_0x7e3a[38]](processes,{id:_0xf7acx20[_0x7e3a[37]],channel:_0x7e3a[26]});if(_0xf7acx22){_0xf7acx22[_0x7e3a[42]][_0x7e3a[41]]({type:_0x7e3a[50],id:_0xf7acx20[_0x7e3a[44]],membername:_0xf7acx20[_0x7e3a[40]]})}}}});function handleMessage(msg){var _0xf7acx24;var _0xf7acx25;var _0xf7acx26;var _0xf7acx27;var _0xf7acx28;var _0xf7acx29,_0xf7acx2a,_0xf7acx2b,_0xf7acx2c;if(msg[_0x7e3a[52]]){return Message[_0x7e3a[98]]({where:{messageId:msg[_0x7e3a[52]][0],accountId:msg[_0x7e3a[99]]}})[_0x7e3a[43]](function(_0xf7acx36){if(_0xf7acx36){return _0xf7acx36[_0x7e3a[104]]()[_0x7e3a[43]](function(_0xf7acx35){_0xf7acx24= _0xf7acx35;if(_0xf7acx35[_0x7e3a[91]]!== _0x7e3a[92]){return _0xf7acx24[_0x7e3a[48]]({status:_0x7e3a[101],openReason:_0x7e3a[102],waiting:true},{individualHooks:true})[_0x7e3a[43]](function(){return Account[_0x7e3a[100]](msg[_0x7e3a[99]])[_0x7e3a[43]](function(_0xf7acx38){_0xf7acx26= _0xf7acx38;if(_0xf7acx26[_0x7e3a[94]]){return Company[_0x7e3a[98]]({where:{emailDomain:msg[_0x7e3a[81]][0][_0x7e3a[82]][_0x7e3a[96]](_0x7e3a[95])[1]}})[_0x7e3a[43]](function(_0xf7acx39){return Contact[_0x7e3a[97]]({where:{email:msg[_0x7e3a[81]][0][_0x7e3a[82]]},defaults:{email:msg[_0x7e3a[81]][0][_0x7e3a[82]],firstName:msg[_0x7e3a[81]][0][_0x7e3a[89]]|| msg[_0x7e3a[81]][0][_0x7e3a[82]][_0x7e3a[96]](_0x7e3a[95])[0],ListId:_0xf7acx26[_0x7e3a[94]],CompanyId:_0xf7acx39?_0xf7acx39[_0x7e3a[73]]:null}})})}else {return []}})[_0x7e3a[93]](function(_0xf7acx37){_0xf7acx27= _0xf7acx37})})}else {return Account[_0x7e3a[100]](msg[_0x7e3a[99]])[_0x7e3a[43]](function(_0xf7acx38){_0xf7acx26= _0xf7acx38;if(_0xf7acx26[_0x7e3a[94]]){return Company[_0x7e3a[98]]({where:{emailDomain:msg[_0x7e3a[81]][0][_0x7e3a[82]][_0x7e3a[96]](_0x7e3a[95])[1]}})[_0x7e3a[43]](function(_0xf7acx39){return Contact[_0x7e3a[97]]({where:{email:msg[_0x7e3a[81]][0][_0x7e3a[82]]},defaults:{email:msg[_0x7e3a[81]][0][_0x7e3a[82]],firstName:msg[_0x7e3a[81]][0][_0x7e3a[89]]|| msg[_0x7e3a[81]][0][_0x7e3a[82]][_0x7e3a[96]](_0x7e3a[95])[0],ListId:_0xf7acx26[_0x7e3a[94]],CompanyId:_0xf7acx39?_0xf7acx39[_0x7e3a[73]]:null}})})}else {return []}})[_0x7e3a[93]](function(_0xf7acx37){_0xf7acx27= _0xf7acx37;return Room[_0x7e3a[74]]({subject:msg[_0x7e3a[80]],from:_[_0x7e3a[83]](msg[_0x7e3a[81]],_0x7e3a[82])[_0x7e3a[71]](_0x7e3a[103]),account:_0xf7acx26[_0x7e3a[89]],attachment:msg[_0x7e3a[55]]&& msg[_0x7e3a[55]][_0x7e3a[56]],lastEvent:_0x7e3a[79],lastEventAt:moment()[_0x7e3a[46]](_0x7e3a[45]),arrivedAt:moment()[_0x7e3a[46]](_0x7e3a[45]),waiting:true,MailAccountId:_0xf7acx26[_0x7e3a[73]],ParentId:_0xf7acx35[_0x7e3a[73]]})})[_0x7e3a[43]](function(_0xf7acx35){_0xf7acx24= _0xf7acx35})}})}else {return Account[_0x7e3a[100]](msg[_0x7e3a[99]])[_0x7e3a[43]](function(_0xf7acx38){_0xf7acx26= _0xf7acx38;if(_0xf7acx26[_0x7e3a[94]]){return Company[_0x7e3a[98]]({where:{emailDomain:msg[_0x7e3a[81]][0][_0x7e3a[82]][_0x7e3a[96]](_0x7e3a[95])[1]}})[_0x7e3a[43]](function(_0xf7acx39){return Contact[_0x7e3a[97]]({where:{email:msg[_0x7e3a[81]][0][_0x7e3a[82]]},defaults:{email:msg[_0x7e3a[81]][0][_0x7e3a[82]],firstName:msg[_0x7e3a[81]][0][_0x7e3a[89]]|| msg[_0x7e3a[81]][0][_0x7e3a[82]][_0x7e3a[96]](_0x7e3a[95])[0],ListId:_0xf7acx26[_0x7e3a[94]],CompanyId:_0xf7acx39?_0xf7acx39[_0x7e3a[73]]:null}})})}else {return []}})[_0x7e3a[93]](function(_0xf7acx37){_0xf7acx27= _0xf7acx37;return Room[_0x7e3a[74]]({subject:msg[_0x7e3a[80]],from:_[_0x7e3a[83]](msg[_0x7e3a[81]],_0x7e3a[82])[_0x7e3a[71]](_0x7e3a[103]),account:_0xf7acx26[_0x7e3a[89]],attachment:msg[_0x7e3a[55]]&& msg[_0x7e3a[55]][_0x7e3a[56]],lastEvent:_0x7e3a[79],waiting:true,lastEventAt:moment()[_0x7e3a[46]](_0x7e3a[45]),arrivedAt:moment()[_0x7e3a[46]](_0x7e3a[45]),MailAccountId:_0xf7acx26[_0x7e3a[73]]})})[_0x7e3a[43]](function(_0xf7acx35){_0xf7acx24= _0xf7acx35})}})[_0x7e3a[43]](function(){return _0xf7acx24[_0x7e3a[48]]({lastEvent:_0x7e3a[79],mailIn:++_0xf7acx24[_0x7e3a[90]]})})[_0x7e3a[43]](function(_0xf7acx35){return Message[_0x7e3a[74]]({fromId:_0xf7acx27?_0xf7acx27[_0x7e3a[73]]:null,messageId:msg[_0x7e3a[78]],status:_0x7e3a[79],subject:msg[_0x7e3a[80]],from:_[_0x7e3a[83]](msg[_0x7e3a[81]],_0x7e3a[82]),to:msg[_0x7e3a[84]]?_[_0x7e3a[83]](msg[_0x7e3a[84]],_0x7e3a[82]):[],cc:msg[_0x7e3a[85]]?_[_0x7e3a[83]](msg[_0x7e3a[85]],_0x7e3a[82]):[],bcc:msg[_0x7e3a[86]]?_[_0x7e3a[83]](msg[_0x7e3a[86]],_0x7e3a[82]):[],text:msg[_0x7e3a[87]]|| null,html:msg[_0x7e3a[88]]|| null,MailRoomId:_0xf7acx24[_0x7e3a[73]],accountName:_0xf7acx26[_0x7e3a[89]],accountId:_0xf7acx26[_0x7e3a[73]],inReplyTo:msg[_0x7e3a[52]][0]})})[_0x7e3a[43]](function(_0xf7acx2d){var _0xf7acx2e=[];var _0xf7acx2f=_0xf7acx2d;if(ami){ami[_0x7e3a[41]]({message:_0x7e3a[54],doc:_0xf7acx2d})};createAndStartRouting(_0xf7acx24,msg,_0xf7acx2d[_0x7e3a[31]]({plain:true}),_0xf7acx26);if(msg[_0x7e3a[55]]&& msg[_0x7e3a[55]][_0x7e3a[56]]){msg[_0x7e3a[55]][_0x7e3a[76]](function(_0xf7acx30){var _0xf7acx31=_0x7e3a[57]+ Math[_0x7e3a[58]](32);var _0xf7acx32;_0xf7acx2e[_0x7e3a[75]](Attachment[_0x7e3a[74]]({name:_0xf7acx30[_0x7e3a[61]],basename:_0xf7acx31,path:path[_0x7e3a[71]](config[_0x7e3a[67]],_0x7e3a[68],_0x7e3a[69],_0x7e3a[55],_0x7e3a[70],_0xf7acx31),type:_0xf7acx30[_0x7e3a[72]],size:_0xf7acx30[_0x7e3a[56]],MailMessageId:_0xf7acx2f[_0x7e3a[73]]})[_0x7e3a[43]](function(_0xf7acx34){return open(_0xf7acx34[_0x7e3a[3]],_0x7e3a[66])})[_0x7e3a[43]](function(_0xf7acx33){_0xf7acx32= _0xf7acx33;return write(_0xf7acx32, new Buffer(_0xf7acx30[_0x7e3a[65]][_0x7e3a[64]]),0,_0xf7acx30[_0x7e3a[56]])})[_0x7e3a[43]](function(){return close(_0xf7acx32)})[_0x7e3a[43]](function(){logger[_0x7e3a[63]](_0x7e3a[60],_0xf7acx30[_0x7e3a[61]],_0x7e3a[62])})[_0x7e3a[36]](function(_0xf7acx21){logger[_0x7e3a[35]](_0x7e3a[59],_0xf7acx21[_0x7e3a[53]])}))})};return Promise[_0x7e3a[77]](_0xf7acx2e)})[_0x7e3a[36]](function(_0xf7acx21){logger[_0x7e3a[35]](_0xf7acx21[_0x7e3a[53]])})}else {return Account[_0x7e3a[100]](msg[_0x7e3a[99]])[_0x7e3a[43]](function(_0xf7acx38){_0xf7acx26= _0xf7acx38;if(_0xf7acx26[_0x7e3a[94]]){return Company[_0x7e3a[98]]({where:{emailDomain:msg[_0x7e3a[81]][0][_0x7e3a[82]][_0x7e3a[96]](_0x7e3a[95])[1]}})[_0x7e3a[43]](function(_0xf7acx39){return Contact[_0x7e3a[97]]({where:{email:msg[_0x7e3a[81]][0][_0x7e3a[82]]},defaults:{email:msg[_0x7e3a[81]][0][_0x7e3a[82]],firstName:msg[_0x7e3a[81]][0][_0x7e3a[89]]|| msg[_0x7e3a[81]][0][_0x7e3a[82]][_0x7e3a[96]](_0x7e3a[95])[0],ListId:_0xf7acx26[_0x7e3a[94]],CompanyId:_0xf7acx39?_0xf7acx39[_0x7e3a[73]]:null}})})}else {return []}})[_0x7e3a[93]](function(_0xf7acx37){_0xf7acx27= _0xf7acx37;return Room[_0x7e3a[74]]({mailIn:1,account:_0xf7acx26[_0x7e3a[89]],subject:msg[_0x7e3a[80]],from:_[_0x7e3a[83]](msg[_0x7e3a[81]],_0x7e3a[82])[_0x7e3a[71]](_0x7e3a[103]),status:_0x7e3a[106],lastEvent:_0x7e3a[79],lastEventAt:moment()[_0x7e3a[46]](_0x7e3a[45]),arrivedAt:moment()[_0x7e3a[46]](_0x7e3a[45]),attachment:msg[_0x7e3a[55]]&& msg[_0x7e3a[55]][_0x7e3a[56]],waiting:true,MailMessages:[{messageId:msg[_0x7e3a[78]],subject:msg[_0x7e3a[80]],from:_[_0x7e3a[83]](msg[_0x7e3a[81]],_0x7e3a[82]),fromId:_0xf7acx27?_0xf7acx27[_0x7e3a[73]]:null,to:msg[_0x7e3a[84]]?_[_0x7e3a[83]](msg[_0x7e3a[84]],_0x7e3a[82]):[],cc:msg[_0x7e3a[85]]?_[_0x7e3a[83]](msg[_0x7e3a[85]],_0x7e3a[82]):[],bcc:msg[_0x7e3a[86]]?_[_0x7e3a[83]](msg[_0x7e3a[86]],_0x7e3a[82]):[],status:_0x7e3a[79],text:msg[_0x7e3a[87]]|| null,html:msg[_0x7e3a[88]]|| null,accountName:_0xf7acx26[_0x7e3a[89]],accountId:_0xf7acx26[_0x7e3a[73]]}],MailAccountId:msg[_0x7e3a[99]]},{include:[{model:Message}]})})[_0x7e3a[43]](function(_0xf7acx3a){var _0xf7acx2e=[];var _0xf7acx3b=_0xf7acx3a;ami[_0x7e3a[41]]({message:_0x7e3a[54],doc:_0xf7acx3a[_0x7e3a[105]][0]});createAndStartRouting(_0xf7acx3b,msg,_0xf7acx3b[_0x7e3a[105]][0][_0x7e3a[31]]({plain:true}),_0xf7acx26);if(msg[_0x7e3a[55]]&& msg[_0x7e3a[55]][_0x7e3a[56]]){msg[_0x7e3a[55]][_0x7e3a[76]](function(_0xf7acx30){var _0xf7acx31=_0x7e3a[57]+ Math[_0x7e3a[58]](32);var _0xf7acx32;_0xf7acx2e[_0x7e3a[75]](Attachment[_0x7e3a[74]]({name:_0xf7acx30[_0x7e3a[61]],basename:_0xf7acx31,path:path[_0x7e3a[71]](config[_0x7e3a[67]],_0x7e3a[68],_0x7e3a[69],_0x7e3a[55],_0x7e3a[70],_0xf7acx31),type:_0xf7acx30[_0x7e3a[72]],size:_0xf7acx30[_0x7e3a[56]],MailMessageId:_0xf7acx3b[_0x7e3a[105]][0][_0x7e3a[73]]})[_0x7e3a[43]](function(_0xf7acx34){return open(_0xf7acx34[_0x7e3a[3]],_0x7e3a[66])})[_0x7e3a[43]](function(_0xf7acx33){_0xf7acx32= _0xf7acx33;return write(_0xf7acx32, new Buffer(_0xf7acx30[_0x7e3a[65]][_0x7e3a[64]]),0,_0xf7acx30[_0x7e3a[56]])})[_0x7e3a[43]](function(){return close(_0xf7acx32)})[_0x7e3a[43]](function(){logger[_0x7e3a[63]](_0x7e3a[60],_0xf7acx30[_0x7e3a[61]],_0x7e3a[62])})[_0x7e3a[36]](function(_0xf7acx21){logger[_0x7e3a[35]](_0x7e3a[59],_0xf7acx21[_0x7e3a[53]])}))})};return Promise[_0x7e3a[77]](_0xf7acx2e)})[_0x7e3a[36]](function(_0xf7acx21){logger[_0x7e3a[35]](_0xf7acx21[_0x7e3a[53]])})}}function handleState(_0xf7acx3d,_0xf7acx20){return ms[_0x7e3a[100]](_0xf7acx3d)[_0x7e3a[43]](function(_0xf7acx3e){return _0xf7acx3e[_0x7e3a[48]]({state:_0xf7acx20[_0x7e3a[108]],source:_0xf7acx20[_0x7e3a[109]]|| null})})[_0x7e3a[36]](function(_0xf7acx21){logger[_0x7e3a[35]](_0x7e3a[107],_0xf7acx21[_0x7e3a[53]])})}function fork(_0xf7acx3d,_0xf7acx40){return cp[_0x7e3a[117]](__dirname+ _0x7e3a[116],[_0xf7acx3d,_0xf7acx40])[_0x7e3a[111]](_0x7e3a[113],function(_0xf7acx20){switch(_0xf7acx20[_0x7e3a[115]]){case _0x7e3a[114]:handleMessage(_0xf7acx20);break;case _0x7e3a[108]:handleState(_0xf7acx3d,_0xf7acx20);break;default:}})[_0x7e3a[111]](_0x7e3a[24],function(_0xf7acx41){logger[_0x7e3a[63]](util[_0x7e3a[46]](_0x7e3a[112],_0xf7acx40,_0xf7acx41))})[_0x7e3a[111]](_0x7e3a[35],function(_0xf7acx21){logger[_0x7e3a[35]](_0x7e3a[110],_0xf7acx21[_0x7e3a[53]])})}function execRequest(_0xf7acx1e,_0xf7acx43,_0xf7acx44){Util[_0x7e3a[121]](_0xf7acx1e,_0xf7acx43,_0xf7acx44)[_0x7e3a[43]](function(_0xf7acx45){logger[_0x7e3a[63]](_0x7e3a[120])})[_0x7e3a[36]](function(_0xf7acx21){logger[_0x7e3a[119]](_0x7e3a[118])})}function webhook(_0xf7acx1e,_0xf7acx47,_0xf7acx48){var _0xf7acx49=_0xf7acx47;switch(_0xf7acx48){case _0x7e3a[130]:if(_0xf7acx49[_0x7e3a[122]]&& _0xf7acx49[_0x7e3a[123]]){logger[_0x7e3a[63]](_0x7e3a[124]+ _0xf7acx49[_0x7e3a[89]]+ _0x7e3a[125]);execRequest(_0xf7acx1e[_0x7e3a[126]],_0xf7acx49[_0x7e3a[122]],_0xf7acx49[_0x7e3a[123]])};if(_0xf7acx49[_0x7e3a[127]][_0x7e3a[56]]){_[_0x7e3a[76]](_0xf7acx49[_0x7e3a[127]],function(_0xf7acx4a){if(_0xf7acx4a[_0x7e3a[128]]){Util[_0x7e3a[129]](_0xf7acx4a,_0xf7acx1e)}})};break;case _0x7e3a[50]:if(_0xf7acx49[_0x7e3a[131]]&& _0xf7acx49[_0x7e3a[132]]){logger[_0x7e3a[63]](_0x7e3a[124]+ _0xf7acx49[_0x7e3a[89]]+ _0x7e3a[133]);execRequest(_0xf7acx1e[_0x7e3a[126]],_0xf7acx49[_0x7e3a[131]],_0xf7acx49[_0x7e3a[132]])};break;case _0x7e3a[24]:if(_0xf7acx49[_0x7e3a[134]]&& _0xf7acx49[_0x7e3a[135]]){logger[_0x7e3a[63]](_0x7e3a[124]+ _0xf7acx49[_0x7e3a[89]]+ _0x7e3a[136]);execRequest(_0xf7acx1e[_0x7e3a[126]],_0xf7acx49[_0x7e3a[134]],_0xf7acx49[_0x7e3a[135]])};break;default:logger[_0x7e3a[35]](_0x7e3a[137])}}function synch(_0xf7acx4c,_0xf7acx4d){Account[_0x7e3a[142]](function(_0xf7acx1e){var _0xf7acx47=_[_0x7e3a[38]](_0xf7acx4c,{id:_0xf7acx1e[_0x7e3a[73]]});if(_0xf7acx47&& _0xf7acx47[_0x7e3a[8]]){if(_0xf7acx4d[_0xf7acx47[_0x7e3a[8]][_0x7e3a[73]]]){logger[_0x7e3a[63]](util[_0x7e3a[46]](_0x7e3a[138],_0xf7acx47[_0x7e3a[8]][_0x7e3a[73]],_0xf7acx4d[_0xf7acx47[_0x7e3a[8]][_0x7e3a[73]]][_0x7e3a[139]]));_0xf7acx4d[_0xf7acx47[_0x7e3a[8]][_0x7e3a[73]]][_0x7e3a[140]]();_0xf7acx4d[_0xf7acx47[_0x7e3a[8]][_0x7e3a[73]]]= null};_[_0x7e3a[141]](_0xf7acx4c,{id:_0xf7acx1e[_0x7e3a[73]]})}});Account[_0x7e3a[143]](function(_0xf7acx1e){_0xf7acx4c[_0x7e3a[75]](_0xf7acx1e)});Account[_0x7e3a[51]](function(_0xf7acx1e){var _0xf7acx4e=_[_0x7e3a[38]](_0xf7acx4c,{id:_0xf7acx1e[_0x7e3a[73]]});if(_0xf7acx4e){logger[_0x7e3a[63]](_0x7e3a[144]+ _0xf7acx4e[_0x7e3a[89]]+ _0x7e3a[145]);_[_0x7e3a[146]](_0xf7acx4e,_0xf7acx1e)}else {_0xf7acx4c[_0x7e3a[147]](_0xf7acx1e)}})}function createAndStartRouting(_0xf7acx3a,_0xf7acx50,_0xf7acx2d,_0xf7acx47){return queue[_0x7e3a[74]](_0x7e3a[150],{title:util[_0x7e3a[46]](_0x7e3a[151],_0xf7acx2d[_0x7e3a[81]]),room:_0xf7acx3a,message:_0xf7acx50,mailMessage:_0xf7acx2d,account:_0xf7acx47})[_0x7e3a[149]](true)[_0x7e3a[148]]()}function handleMail(_0xf7acx52,_0xf7acx53){var _0xf7acx50=_0xf7acx52[_0x7e3a[64]][_0x7e3a[113]];var _0xf7acx2d=_0xf7acx52[_0x7e3a[64]][_0x7e3a[152]];var _0xf7acx3a=_0xf7acx52[_0x7e3a[64]][_0x7e3a[153]];var _0xf7acx47=_0xf7acx52[_0x7e3a[64]][_0x7e3a[154]];var _0xf7acx54=_0xf7acx53;var _0xf7acx55=cp[_0x7e3a[117]](path[_0x7e3a[71]](config[_0x7e3a[67]],_0x7e3a[162]))[_0x7e3a[111]](_0x7e3a[113],function(msg){switch(msg[_0x7e3a[115]]){case _0x7e3a[159]:return Message[_0x7e3a[74]](msg[_0x7e3a[114]],{include:[{model:Attachment}]});case _0x7e3a[160]:return SmsMessage[_0x7e3a[74]](msg[_0x7e3a[114]]);case _0x7e3a[161]:ami[_0x7e3a[41]]({message:msg[_0x7e3a[115]],doc:msg[_0x7e3a[114]]});break;default:}})[_0x7e3a[111]](_0x7e3a[156],function(){var _0xf7acx56=_[_0x7e3a[141]](processes,{pid:this[_0x7e3a[139]]});if(_0xf7acx56&& _0xf7acx56[_0x7e3a[56]]){return Room[_0x7e3a[100]](_0xf7acx56[0][_0x7e3a[158]])[_0x7e3a[43]](function(_0xf7acx3a){if(_0xf7acx3a){return _0xf7acx3a[_0x7e3a[48]]({waiting:false})}})[_0x7e3a[157]](function(){_0xf7acx54()})}})[_0x7e3a[111]](_0x7e3a[24],function(){_0xf7acx54()})[_0x7e3a[111]](_0x7e3a[155],function(){_0xf7acx54()})[_0x7e3a[111]](_0x7e3a[35],function(_0xf7acx21){_0xf7acx54(_0xf7acx21)});_0xf7acx55[_0x7e3a[41]]({type:_0x7e3a[163],param1:{channel:_0x7e3a[26],uniqueid:util[_0x7e3a[46]](_0x7e3a[164],moment()[_0x7e3a[165]](),_0xf7acx3a[_0x7e3a[73]]),subject:_0xf7acx50[_0x7e3a[80]],messageid:_0xf7acx2d[_0x7e3a[73]],roomid:_0xf7acx3a[_0x7e3a[73]],accountid:_0xf7acx47[_0x7e3a[73]],accountname:_0xf7acx47[_0x7e3a[89]],accountaddress:_0xf7acx47[_0x7e3a[82]],from:_0xf7acx50[_0x7e3a[81]][0][_0x7e3a[82]],cc:_0xf7acx50[_0x7e3a[85]]?_[_0x7e3a[83]](_0xf7acx50[_0x7e3a[85]],_0x7e3a[82]):[]},param2:_0xf7acx2d});processes[_0x7e3a[75]]({id:_0xf7acx2d[_0x7e3a[73]],channel:_0x7e3a[26],process:_0xf7acx55,roomid:_0xf7acx3a[_0x7e3a[73]],pid:_0xf7acx55[_0x7e3a[139]]})}module[_0x7e3a[166]]= function(_0xf7acx57){var _0xf7acx4d={};var _0xf7acx4c;var _0xf7acx58;ami= _0xf7acx57;process[_0x7e3a[111]](_0x7e3a[156],function(_0xf7acx41){for(var _0xf7acx59 in _0xf7acx4d){if(_0xf7acx4d[_0xf7acx59]){_0xf7acx4d[_0xf7acx59][_0x7e3a[140]]()}}});Setting[_0x7e3a[38]]({where:{id:1},attributes:[_0x7e3a[73],_0x7e3a[170]],raw:true})[_0x7e3a[43]](function(_0xf7acx5b){if(_0xf7acx5b){queue[_0x7e3a[42]](_0x7e3a[150],_0xf7acx5b[_0x7e3a[170]],handleMail)};return Account[_0x7e3a[171]]({include:[ms]})})[_0x7e3a[43]](function(_0xf7acx5a){_0xf7acx4c= _0xf7acx5a;synch(_0xf7acx4c,_0xf7acx4d);_0xf7acx4c[_0x7e3a[76]](function(_0xf7acx47){if(_0xf7acx47[_0x7e3a[8]]){_0xf7acx4d[_0xf7acx47[_0x7e3a[8]][_0x7e3a[73]]]= fork(_0xf7acx47[_0x7e3a[8]][_0x7e3a[73]],_0xf7acx47[_0x7e3a[8]][_0x7e3a[167]])}});Report[_0x7e3a[51]](function(_0xf7acx1e){var _0xf7acx47=_[_0x7e3a[38]](_0xf7acx4c,{id:parseInt(_0xf7acx1e[_0x7e3a[168]])});if(_0xf7acx47&& _0xf7acx1e[_0x7e3a[33]](_0x7e3a[32])){webhook(_0xf7acx1e,_0xf7acx47,_0x7e3a[130])};if(_0xf7acx47&& _0xf7acx1e[_0x7e3a[33]](_0x7e3a[49])){webhook(_0xf7acx1e,_0xf7acx47,_0x7e3a[50])}});Room[_0x7e3a[51]](function(_0xf7acx1e){var _0xf7acx47=_[_0x7e3a[38]](_0xf7acx4c,{id:_0xf7acx1e[_0x7e3a[169]]});if(_0xf7acx47&& _0xf7acx1e[_0x7e3a[33]](_0x7e3a[91])&& _0xf7acx1e[_0x7e3a[91]]=== _0x7e3a[92]){webhook(_0xf7acx1e,_0xf7acx47,_0x7e3a[24])}})})[_0x7e3a[36]](function(_0xf7acx21){logger[_0x7e3a[35]](_0xf7acx21[_0x7e3a[53]])});ms[_0x7e3a[143]](function(_0xf7acx3e){var _0xf7acx47=_[_0x7e3a[38]](_0xf7acx4c,{id:_0xf7acx3e[_0x7e3a[169]]});if(_0xf7acx47){_0xf7acx47[_0x7e3a[8]]= _0xf7acx3e};_0xf7acx4d[_0xf7acx3e[_0x7e3a[73]]]= fork(_0xf7acx3e[_0x7e3a[73]],_0xf7acx3e[_0x7e3a[167]])});ms[_0x7e3a[51]](function(_0xf7acx3e){if(_0xf7acx4d[_0xf7acx3e[_0x7e3a[73]]]){if(_0xf7acx3e[_0x7e3a[33]](_0x7e3a[108])|| _0xf7acx3e[_0x7e3a[33]](_0x7e3a[109])){logger[_0x7e3a[63]](util[_0x7e3a[46]](_0x7e3a[172],_0xf7acx3e[_0x7e3a[73]],_0xf7acx4d[_0xf7acx3e[_0x7e3a[73]]][_0x7e3a[139]]))}else {_0xf7acx4d[_0xf7acx3e[_0x7e3a[73]]][_0x7e3a[140]]();_0xf7acx4d[_0xf7acx3e[_0x7e3a[73]]]= null;_0xf7acx4d[_0xf7acx3e[_0x7e3a[73]]]= fork(_0xf7acx3e[_0x7e3a[73]],_0xf7acx3e[_0x7e3a[167]])}}});ms[_0x7e3a[142]](function(_0xf7acx3e){if(_0xf7acx4d[_0xf7acx3e[_0x7e3a[73]]]){logger[_0x7e3a[63]](util[_0x7e3a[46]](_0x7e3a[138],_0xf7acx3e[_0x7e3a[73]],_0xf7acx4d[_0xf7acx3e[_0x7e3a[73]]][_0x7e3a[139]]));_0xf7acx4d[_0xf7acx3e[_0x7e3a[73]]][_0x7e3a[140]]();_0xf7acx4d[_0xf7acx3e[_0x7e3a[73]]]= null}})}
\ No newline at end of file