3ddd56dc884d89f22286a56144d5134c59132748
[motion.git] / server / config / imap / index.js
1 var _0x3ef8=["\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"];_0x3ef8[0];const _=require(_0x3ef8[1]);const util=require(_0x3ef8[2]);const path=require(_0x3ef8[3]);const cp=require(_0x3ef8[4]);const ms=require(_0x3ef8[6])[_0x3ef8[5]];const msg=require(_0x3ef8[6])[_0x3ef8[7]];const Room=require(_0x3ef8[6])[_0x3ef8[8]];const Message=require(_0x3ef8[6])[_0x3ef8[7]];const Account=require(_0x3ef8[6])[_0x3ef8[9]];const Contact=require(_0x3ef8[6])[_0x3ef8[10]];const Company=require(_0x3ef8[6])[_0x3ef8[11]];const Attachment=require(_0x3ef8[6])[_0x3ef8[12]];const Promise=require(_0x3ef8[13]);const moment=require(_0x3ef8[14]);const open=Promise[_0x3ef8[17]](require(_0x3ef8[16])[_0x3ef8[15]]);const close=Promise[_0x3ef8[17]](require(_0x3ef8[16])[_0x3ef8[18]]);const write=Promise[_0x3ef8[17]](require(_0x3ef8[16])[_0x3ef8[19]]);const config=require(_0x3ef8[20]);function handleMessage(msg){var _0xeecax14;var _0xeecax15;var _0xeecax16;var _0xeecax17;var _0xeecax18;var _0xeecax19,_0xeecax1a,_0xeecax1b,_0xeecax1c;if(msg[_0x3ef8[21]]){return Message[_0x3ef8[69]]({where:{messageId:msg[_0x3ef8[21]][0]}})[_0x3ef8[33]](function(_0xeecax27){if(_0xeecax27){return _0xeecax27[_0x3ef8[72]]()[_0x3ef8[33]](function(_0xeecax26){if(_0xeecax26[_0x3ef8[60]]!==_0x3ef8[61]){return _0xeecax26}else {return Account[_0x3ef8[71]](msg[_0x3ef8[70]])[_0x3ef8[33]](function(_0xeecax29){_0xeecax16=_0xeecax29;if(_0xeecax16[_0x3ef8[65]]){return Company[_0x3ef8[69]]({where:{emailDomain:msg[_0x3ef8[51]][0][_0x3ef8[52]][_0x3ef8[67]](_0x3ef8[66])[1]}})[_0x3ef8[33]](function(_0xeecax2a){return Contact[_0x3ef8[68]]({where:{email:msg[_0x3ef8[51]][0][_0x3ef8[52]]},defaults:{email:msg[_0x3ef8[51]][0][_0x3ef8[52]],firstName:msg[_0x3ef8[51]][0][_0x3ef8[63]]||msg[_0x3ef8[51]][0][_0x3ef8[52]][_0x3ef8[67]](_0x3ef8[66])[0],ListId:_0xeecax16[_0x3ef8[65]],CompanyId:_0xeecax2a?_0xeecax2a[_0x3ef8[43]]:null}})})}else {return []}})[_0x3ef8[64]](function(_0xeecax28){_0xeecax17=_0xeecax28;return Room[_0x3ef8[44]]({subject:msg[_0x3ef8[50]],from:_[_0x3ef8[53]](msg[_0x3ef8[51]],_0x3ef8[52])[_0x3ef8[41]](_0x3ef8[62]),account:_0xeecax16[_0x3ef8[63]],attachment:msg[_0x3ef8[25]]&&msg[_0x3ef8[25]][_0x3ef8[26]],MailAccountId:_0xeecax16[_0x3ef8[43]],ParentId:_0xeecax26[_0x3ef8[43]]})})}})}else {return Account[_0x3ef8[71]](msg[_0x3ef8[70]])[_0x3ef8[33]](function(_0xeecax29){_0xeecax16=_0xeecax29;if(_0xeecax16[_0x3ef8[65]]){return Company[_0x3ef8[69]]({where:{emailDomain:msg[_0x3ef8[51]][0][_0x3ef8[52]][_0x3ef8[67]](_0x3ef8[66])[1]}})[_0x3ef8[33]](function(_0xeecax2a){return Contact[_0x3ef8[68]]({where:{email:msg[_0x3ef8[51]][0][_0x3ef8[52]]},defaults:{email:msg[_0x3ef8[51]][0][_0x3ef8[52]],firstName:msg[_0x3ef8[51]][0][_0x3ef8[63]]||msg[_0x3ef8[51]][0][_0x3ef8[52]][_0x3ef8[67]](_0x3ef8[66])[0],ListId:_0xeecax16[_0x3ef8[65]],CompanyId:_0xeecax2a?_0xeecax2a[_0x3ef8[43]]:null}})})}else {return []}})[_0x3ef8[64]](function(_0xeecax28){_0xeecax17=_0xeecax28;return Room[_0x3ef8[44]]({subject:msg[_0x3ef8[50]],from:_[_0x3ef8[53]](msg[_0x3ef8[51]],_0x3ef8[52])[_0x3ef8[41]](_0x3ef8[62]),account:_0xeecax16[_0x3ef8[63]],attachment:msg[_0x3ef8[25]]&&msg[_0x3ef8[25]][_0x3ef8[26]],MailAccountId:_0xeecax16[_0x3ef8[43]]})})}})[_0x3ef8[33]](function(_0xeecax26){_0xeecax14=_0xeecax26;return _0xeecax14[_0x3ef8[59]]({lastEvent:_0x3ef8[49],mailIn:++_0xeecax14[_0x3ef8[58]]})})[_0x3ef8[33]](function(_0xeecax26){return Message[_0x3ef8[44]]({fromId:_0xeecax17?_0xeecax17[_0x3ef8[43]]:null,messageId:msg[_0x3ef8[48]],status:_0x3ef8[49],subject:msg[_0x3ef8[50]],from:_[_0x3ef8[53]](msg[_0x3ef8[51]],_0x3ef8[52]),to:msg[_0x3ef8[54]]?_[_0x3ef8[53]](msg[_0x3ef8[54]],_0x3ef8[52]):[],cc:msg[_0x3ef8[55]]?_[_0x3ef8[53]](msg[_0x3ef8[55]],_0x3ef8[52]):[],bcc:msg[_0x3ef8[56]]?_[_0x3ef8[53]](msg[_0x3ef8[56]],_0x3ef8[52]):[],text:msg[_0x3ef8[57]]||null,MailRoomId:_0xeecax14[_0x3ef8[43]]})})[_0x3ef8[33]](function(_0xeecax1e){require(_0x3ef8[24])(_0xeecax1e);var _0xeecax1f=[];var _0xeecax20=_0xeecax1e;if(msg[_0x3ef8[25]]&&msg[_0x3ef8[25]][_0x3ef8[26]]){msg[_0x3ef8[25]][_0x3ef8[46]](function(_0xeecax21){var _0xeecax22=_0x3ef8[27]+Math[_0x3ef8[28]](32);var _0xeecax23;_0xeecax1f[_0x3ef8[45]](Attachment[_0x3ef8[44]]({name:_0xeecax21[_0x3ef8[30]],basename:_0xeecax22,path:path[_0x3ef8[41]](config[_0x3ef8[37]],_0x3ef8[38],_0x3ef8[39],_0x3ef8[25],_0x3ef8[40],_0xeecax22),type:_0xeecax21[_0x3ef8[42]],size:_0xeecax21[_0x3ef8[26]],MailMessageId:_0xeecax20[_0x3ef8[43]]})[_0x3ef8[33]](function(_0xeecax25){return open(_0xeecax25[_0x3ef8[3]],_0x3ef8[36])})[_0x3ef8[33]](function(_0xeecax24){_0xeecax23=_0xeecax24;return write(_0xeecax23, new Buffer(_0xeecax21[_0x3ef8[35]][_0x3ef8[34]]),0,_0xeecax21[_0x3ef8[26]])})[_0x3ef8[33]](function(){return close(_0xeecax23)})[_0x3ef8[33]](function(){console[_0x3ef8[32]](_0x3ef8[29],_0xeecax21[_0x3ef8[30]],_0x3ef8[31])})[_0x3ef8[23]](function(_0xeecax1d){console[_0x3ef8[22]](_0xeecax1d)}))})};return Promise[_0x3ef8[47]](_0xeecax1f)})[_0x3ef8[23]](function(_0xeecax1d){console[_0x3ef8[22]](_0xeecax1d)})}else {return Account[_0x3ef8[71]](msg[_0x3ef8[70]])[_0x3ef8[33]](function(_0xeecax29){_0xeecax16=_0xeecax29;if(_0xeecax16[_0x3ef8[65]]){return Company[_0x3ef8[69]]({where:{emailDomain:msg[_0x3ef8[51]][0][_0x3ef8[52]][_0x3ef8[67]](_0x3ef8[66])[1]}})[_0x3ef8[33]](function(_0xeecax2a){return Contact[_0x3ef8[68]]({where:{email:msg[_0x3ef8[51]][0][_0x3ef8[52]]},defaults:{email:msg[_0x3ef8[51]][0][_0x3ef8[52]],firstName:msg[_0x3ef8[51]][0][_0x3ef8[63]]||msg[_0x3ef8[51]][0][_0x3ef8[52]][_0x3ef8[67]](_0x3ef8[66])[0],ListId:_0xeecax16[_0x3ef8[65]],CompanyId:_0xeecax2a?_0xeecax2a[_0x3ef8[43]]:null}})})}else {return []}})[_0x3ef8[64]](function(_0xeecax28){_0xeecax17=_0xeecax28;return Room[_0x3ef8[44]]({mailIn:1,account:_0xeecax16[_0x3ef8[63]],subject:msg[_0x3ef8[50]],from:_[_0x3ef8[53]](msg[_0x3ef8[51]],_0x3ef8[52])[_0x3ef8[41]](_0x3ef8[62]),lastEvent:_0x3ef8[49],lastEventAt:moment()[_0x3ef8[75]](_0x3ef8[74]),attachment:msg[_0x3ef8[25]]&&msg[_0x3ef8[25]][_0x3ef8[26]],MailMessages:[{messageId:msg[_0x3ef8[48]],subject:msg[_0x3ef8[50]],from:_[_0x3ef8[53]](msg[_0x3ef8[51]],_0x3ef8[52]),fromId:_0xeecax17?_0xeecax17[_0x3ef8[43]]:null,to:msg[_0x3ef8[54]]?_[_0x3ef8[53]](msg[_0x3ef8[54]],_0x3ef8[52]):[],cc:msg[_0x3ef8[55]]?_[_0x3ef8[53]](msg[_0x3ef8[55]],_0x3ef8[52]):[],bcc:msg[_0x3ef8[56]]?_[_0x3ef8[53]](msg[_0x3ef8[56]],_0x3ef8[52]):[],status:_0x3ef8[49],text:msg[_0x3ef8[57]]||null}],MailAccountId:msg[_0x3ef8[70]]},{include:[{model:Message}]})})[_0x3ef8[33]](function(_0xeecax2b){var _0xeecax1f=[];var _0xeecax2c=_0xeecax2b;require(_0x3ef8[24])(_0xeecax2c[_0x3ef8[73]][0]);if(msg[_0x3ef8[25]]&&msg[_0x3ef8[25]][_0x3ef8[26]]){msg[_0x3ef8[25]][_0x3ef8[46]](function(_0xeecax21){var _0xeecax22=_0x3ef8[27]+Math[_0x3ef8[28]](32);var _0xeecax23;_0xeecax1f[_0x3ef8[45]](Attachment[_0x3ef8[44]]({name:_0xeecax21[_0x3ef8[30]],basename:_0xeecax22,path:path[_0x3ef8[41]](config[_0x3ef8[37]],_0x3ef8[38],_0x3ef8[39],_0x3ef8[25],_0x3ef8[40],_0xeecax22),type:_0xeecax21[_0x3ef8[42]],size:_0xeecax21[_0x3ef8[26]],MailMessageId:_0xeecax2c[_0x3ef8[73]][0][_0x3ef8[43]]})[_0x3ef8[33]](function(_0xeecax25){return open(_0xeecax25[_0x3ef8[3]],_0x3ef8[36])})[_0x3ef8[33]](function(_0xeecax24){_0xeecax23=_0xeecax24;return write(_0xeecax23, new Buffer(_0xeecax21[_0x3ef8[35]][_0x3ef8[34]]),0,_0xeecax21[_0x3ef8[26]])})[_0x3ef8[33]](function(){return close(_0xeecax23)})[_0x3ef8[33]](function(){console[_0x3ef8[32]](_0x3ef8[29],_0xeecax21[_0x3ef8[30]],_0x3ef8[31])})[_0x3ef8[23]](function(_0xeecax1d){console[_0x3ef8[22]](_0xeecax1d)}))})};return Promise[_0x3ef8[47]](_0xeecax1f)})[_0x3ef8[23]](function(_0xeecax1d){console[_0x3ef8[22]](_0xeecax1d)})}}function handleState(_0xeecax2e,_0xeecax2f){return ms[_0x3ef8[71]](_0xeecax2e)[_0x3ef8[33]](function(_0xeecax30){return _0xeecax30[_0x3ef8[59]]({state:_0xeecax2f[_0x3ef8[76]],source:_0xeecax2f[_0x3ef8[77]]||null})})[_0x3ef8[23]](function(_0xeecax1d){console[_0x3ef8[22]](_0xeecax1d)})}function fork(_0xeecax2e,_0xeecax32){return cp[_0x3ef8[84]](__dirname+_0x3ef8[83],[_0xeecax2e,_0xeecax32])[_0x3ef8[78]](_0x3ef8[80],function(_0xeecax2f){switch(_0xeecax2f[_0x3ef8[82]]){case _0x3ef8[81]:handleMessage(_0xeecax2f);break;case _0x3ef8[76]:handleState(_0xeecax2e,_0xeecax2f);break;default:}})[_0x3ef8[78]](_0x3ef8[18],function(_0xeecax33){console[_0x3ef8[32]](util[_0x3ef8[75]](_0x3ef8[79],_0xeecax32,_0xeecax33))})[_0x3ef8[78]](_0x3ef8[22],function(_0xeecax1d){console[_0x3ef8[22]](_0xeecax1d)})}module[_0x3ef8[85]]=function(){var _0xeecax34={};var _0xeecax35;process[_0x3ef8[78]](_0x3ef8[86],function(_0xeecax33){for(var _0xeecax36 in _0xeecax34){if(_0xeecax34[_0xeecax36]){_0xeecax34[_0xeecax36][_0x3ef8[87]]()}}});ms[_0x3ef8[89]](function(_0xeecax30){_0xeecax34[_0xeecax30[_0x3ef8[43]]]=fork(_0xeecax30[_0x3ef8[43]],_0xeecax30[_0x3ef8[88]])});ms[_0x3ef8[94]](function(_0xeecax30){if(_0xeecax34[_0xeecax30[_0x3ef8[43]]]){if(_0xeecax30[_0x3ef8[90]](_0x3ef8[76])||_0xeecax30[_0x3ef8[90]](_0x3ef8[77])){console[_0x3ef8[32]](util[_0x3ef8[75]](_0x3ef8[91],_0xeecax30[_0x3ef8[43]],_0xeecax34[_0xeecax30[_0x3ef8[43]]][_0x3ef8[92]]));clearTimeout(_0xeecax35);switch(_0xeecax30[_0x3ef8[76]]){case _0x3ef8[93]:_0xeecax35=setTimeout(function(){_0xeecax34[_0xeecax30[_0x3ef8[43]]]=fork(_0xeecax30[_0x3ef8[43]],_0xeecax30[_0x3ef8[88]])},10000);break;default:}}else {_0xeecax34[_0xeecax30[_0x3ef8[43]]][_0x3ef8[87]]();_0xeecax34[_0xeecax30[_0x3ef8[43]]]=null;_0xeecax34[_0xeecax30[_0x3ef8[43]]]=fork(_0xeecax30[_0x3ef8[43]],_0xeecax30[_0x3ef8[88]])}}});ms[_0x3ef8[96]](function(_0xeecax30){if(_0xeecax34[_0xeecax30[_0x3ef8[43]]]){console[_0x3ef8[32]](util[_0x3ef8[75]](_0x3ef8[95],_0xeecax30[_0x3ef8[43]],_0xeecax34[_0xeecax30[_0x3ef8[43]]][_0x3ef8[92]]));_0xeecax34[_0xeecax30[_0x3ef8[43]]][_0x3ef8[87]]();_0xeecax34[_0xeecax30[_0x3ef8[43]]]=null}});ms[_0x3ef8[97]]()[_0x3ef8[33]](function(_0xeecax37){_0xeecax37[_0x3ef8[46]](function(_0xeecax30){_0xeecax34[_0xeecax30[_0x3ef8[43]]]=fork(_0xeecax30[_0x3ef8[43]],_0xeecax30[_0x3ef8[88]])})})[_0x3ef8[23]](function(_0xeecax1d){console[_0x3ef8[22]](_0xeecax1d)})}