Built motion from commit 5b01f56.|0.0.106
[motion.git] / server / api / mail_account / mail_account.controller.js
1 var _0x1172=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x75\x74\x69\x6C","\x61\x73\x79\x6E\x63","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x75\x74\x69\x6C","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x55\x73\x65\x72","\x4D\x61\x69\x6C\x51\x75\x65\x75\x65","\x4D\x61\x69\x6C\x52\x6F\x6F\x6D","\x4D\x61\x69\x6C\x41\x63\x63\x6F\x75\x6E\x74","\x4D\x61\x69\x6C\x53\x65\x72\x76\x65\x72\x49\x6E","\x4D\x61\x69\x6C\x53\x65\x72\x76\x65\x72\x4F\x75\x74","\x4D\x61\x69\x6C\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E","\x4D\x61\x69\x6C\x44\x69\x73\x70\x6F\x73\x69\x74\x69\x6F\x6E","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x71\x75\x65\x72\x79","\x67\x65\x74\x51\x75\x65\x72\x79","\x66\x69\x6E\x64\x41\x6E\x64\x43\x6F\x75\x6E\x74\x41\x6C\x6C","\x64\x65\x66\x61\x75\x6C\x74","\x73\x63\x6F\x70\x65","\x67\x65\x74\x4D\x61\x69\x6C\x52\x6F\x6F\x6D\x73","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x73\x75\x62\x6A\x65\x63\x74","\x66\x72\x6F\x6D","\x61\x74\x74\x61\x63\x68\x6D\x65\x6E\x74","\x6C\x61\x73\x74\x45\x76\x65\x6E\x74","\x75\x70\x64\x61\x74\x65\x64\x41\x74","\x74\x61\x67\x73","\x69\x73\x41\x72\x72\x61\x79","\x6C\x65\x6E\x67\x74\x68","\x25","\x3B\x25","\x70\x75\x73\x68","\x24\x61\x6E\x64","\x77\x68\x65\x72\x65","\x6D\x65\x72\x67\x65","\x55\x4E\x4D\x41\x4E\x41\x47\x45\x44","\x69\x6E\x63\x6C\x75\x64\x65","\x75\x73\x65\x72","\x61\x67\x65\x6E\x74","\x72\x6F\x6C\x65","\x65\x72\x72\x6F\x72","\x66\x69\x6E\x64\x41\x6C\x6C","\x67\x65\x74\x44\x69\x73\x70\x6F\x73\x69\x74\x69\x6F\x6E\x73","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x67\x65\x74\x4D\x61\x69\x6C\x44\x69\x73\x70\x6F\x73\x69\x74\x69\x6F\x6E\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x73\x68\x6F\x77","\x73\x68\x6F\x77\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x73","\x6E\x61\x6D\x65","\x6F\x6E\x6C\x69\x6E\x65","\x67\x65\x74\x4D\x61\x69\x6C\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x73","\x63\x72\x65\x61\x74\x65","\x68\x61\x6E\x64\x6C\x65\x55\x6E\x69\x71\x75\x65\x43\x6F\x6E\x73\x74\x72\x61\x69\x6E\x74\x45\x72\x72\x6F\x72","\x65\x72\x72\x6F\x72\x4D\x61\x6E\x61\x67\x65\x72","\x62\x6F\x64\x79","\x74\x72\x61\x6E\x73\x61\x63\x74\x69\x6F\x6E","\x63\x72\x65\x61\x74\x65\x44\x69\x73\x70\x6F\x73\x69\x74\x69\x6F\x6E","\x4D\x61\x69\x6C\x41\x63\x63\x6F\x75\x6E\x74\x49\x64","\x75\x70\x64\x61\x74\x65","\x73\x61\x76\x65","\x75\x70\x64\x61\x74\x65\x44\x69\x73\x70\x6F\x73\x69\x74\x69\x6F\x6E","\x64\x69\x73\x70\x49\x64","\x75\x70\x64\x61\x74\x65\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x73","\x63\x72\x65\x61\x74\x65\x64\x41\x74","\x70\x72\x69\x6F\x72\x69\x74\x79","\x66\x6F\x72\x45\x61\x63\x68","\x62\x75\x6C\x6B\x43\x72\x65\x61\x74\x65","\x64\x65\x73\x74\x72\x6F\x79","\x64\x65\x73\x74\x72\x6F\x79\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E","\x61\x70\x70\x49\x64","\x64\x65\x73\x74\x72\x6F\x79\x44\x69\x73\x70\x6F\x73\x69\x74\x69\x6F\x6E","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x69\x64\x73","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x73"];_0x1172[0];var _=require(_0x1172[1]);var util=require(_0x1172[2]);var async=require(_0x1172[3]);var Util=require(_0x1172[4]);var sequelize=require(_0x1172[6])[_0x1172[5]];var User=require(_0x1172[6])[_0x1172[7]];var MailQueue=require(_0x1172[6])[_0x1172[8]];var MailRoom=require(_0x1172[6])[_0x1172[9]];var MailAccount=require(_0x1172[6])[_0x1172[10]];var MailServerIn=require(_0x1172[6])[_0x1172[11]];var MailServerOut=require(_0x1172[6])[_0x1172[12]];var MailApplication=require(_0x1172[6])[_0x1172[13]];var MailDisposition=require(_0x1172[6])[_0x1172[14]];exports[_0x1172[15]]=function(_0xf542xe,_0xf542xf){return MailAccount[_0x1172[24]](_0x1172[23])[_0x1172[22]](Util[_0x1172[21]](_0xf542xe[_0x1172[20]]))[_0x1172[19]](function(_0xf542x11){_0xf542xf[_0x1172[18]](200)[_0x1172[17]](_0xf542x11)})[_0x1172[16]](function(_0xf542x10){return handleError(_0xf542xf,_0xf542x10)})};exports[_0x1172[25]]=function(_0xf542xe,_0xf542xf,_0xf542x12){var _0xf542x13={where:{MailAccountId:_0xf542xe[_0x1172[27]][_0x1172[26]],$and:[]},attributes:[_0x1172[26],_0x1172[28],_0x1172[29],_0x1172[30],_0x1172[31],_0x1172[32]]};if(_0xf542xe[_0x1172[20]]){if(_0xf542xe[_0x1172[20]][_0x1172[33]]){if(_[_0x1172[34]](_0xf542xe[_0x1172[20]][_0x1172[33]])){for(var _0xf542x14=0;_0xf542x14<_0xf542xe[_0x1172[20]][_0x1172[33]][_0x1172[35]];_0xf542x14++){_0xf542x13[_0x1172[40]][_0x1172[39]][_0x1172[38]]({tags:{$like:_0x1172[36]+_0xf542xe[_0x1172[20]][_0x1172[33]][_0xf542x14]+_0x1172[37]}})}}else {_0xf542x13[_0x1172[40]][_0x1172[39]][_0x1172[38]]({tags:{$like:_0x1172[36]+_0xf542xe[_0x1172[20]][_0x1172[33]]+_0x1172[37]}})};delete _0xf542xe[_0x1172[20]][_0x1172[33]]};_[_0x1172[41]](_0xf542x13[_0x1172[40]],_0xf542xe[_0x1172[20]])};switch(_0xf542xe[_0x1172[44]][_0x1172[46]]){case _0x1172[45]:if(_0xf542xe[_0x1172[20]][_0x1172[18]]&&_0xf542xe[_0x1172[20]][_0x1172[18]]!==_0x1172[42]){_0xf542x13[_0x1172[43]]=[{model:User,where:{id:_0xf542xe[_0x1172[44]][_0x1172[26]]}}]};break;default:};return MailRoom[_0x1172[48]](_0xf542x13)[_0x1172[19]](function(_0xf542x15){return _0xf542xf[_0x1172[18]](200)[_0x1172[17]](_0xf542x15)})[_0x1172[16]](function(_0xf542x10){console[_0x1172[47]](_0xf542x10);return handleError(_0xf542xf,_0xf542x10)})};exports[_0x1172[49]]=function(_0xf542xe,_0xf542xf,_0xf542x12){return MailAccount[_0x1172[52]](_0xf542xe[_0x1172[27]][_0x1172[26]])[_0x1172[19]](function(_0xf542x17){if(!_0xf542x17){return _0xf542xf[_0x1172[50]](404)};return _0xf542x17[_0x1172[51]]()})[_0x1172[19]](function(_0xf542x16){return _0xf542xf[_0x1172[18]](200)[_0x1172[17]]({rows:_0xf542x16,count:_0xf542x16[_0x1172[35]]})})[_0x1172[16]](function(_0xf542x10){return handleError(_0xf542xf,_0xf542x10)})};exports[_0x1172[53]]=function(_0xf542xe,_0xf542xf,_0xf542x12){return MailAccount[_0x1172[24]](_0x1172[23])[_0x1172[52]](_0xf542xe[_0x1172[27]][_0x1172[26]])[_0x1172[19]](function(_0xf542x17){if(!_0xf542x17){return _0xf542xf[_0x1172[50]](404)};return _0xf542xf[_0x1172[17]](_0xf542x17)})[_0x1172[16]](function(_0xf542x10){return handleError(_0xf542xf,_0xf542x10)})};exports[_0x1172[54]]=function(_0xf542xe,_0xf542xf,_0xf542x12){return MailAccount[_0x1172[24]](_0x1172[23])[_0x1172[52]](_0xf542xe[_0x1172[27]][_0x1172[26]])[_0x1172[19]](function(_0xf542x17){if(!_0xf542x17){return _0xf542xf[_0x1172[50]](404)};return _0xf542x17[_0x1172[57]](_[_0x1172[41]](Util[_0x1172[21]](_0xf542xe[_0x1172[20]]),{include:[{model:MailQueue,attributes:[_0x1172[26],_0x1172[55]]},{model:User,attributes:[_0x1172[26],_0x1172[55],_0x1172[56]]}]}))})[_0x1172[19]](function(_0xf542x18){return _0xf542xf[_0x1172[17]]({count:_0xf542x18[_0x1172[35]],rows:_0xf542x18})})[_0x1172[16]](function(_0xf542x10){return handleError(_0xf542xf,_0xf542x10)})};exports[_0x1172[58]]=function(_0xf542xe,_0xf542xf,_0xf542x12){return sequelize[_0x1172[62]](function(_0xf542x19){return MailAccount[_0x1172[58]](_0xf542xe[_0x1172[61]],{include:[{model:MailServerIn},{model:MailServerOut}],transaction:_0xf542x19})})[_0x1172[19]](function(_0xf542x17){return _0xf542xf[_0x1172[18]](201)[_0x1172[17]](_0xf542x17)})[_0x1172[16]](sequelize.UniqueConstraintError,function(_0xf542x10){return Util[_0x1172[60]][_0x1172[59]](_0xf542xf,_0xf542x10)})[_0x1172[16]](function(_0xf542x10){return handleError(_0xf542xf,_0xf542x10)})};exports[_0x1172[63]]=function(_0xf542xe,_0xf542xf,_0xf542x12){_0xf542xe[_0x1172[61]][_0x1172[64]]=_0xf542xe[_0x1172[27]][_0x1172[26]];return MailDisposition[_0x1172[58]](_0xf542xe[_0x1172[61]])[_0x1172[19]](function(_0xf542x1a){return _0xf542xf[_0x1172[18]](201)[_0x1172[17]](_0xf542x1a)})[_0x1172[16]](function(_0xf542x10){return handleError(_0xf542xf,_0xf542x10)})};exports[_0x1172[65]]=function(_0xf542xe,_0xf542xf){if(_0xf542xe[_0x1172[61]][_0x1172[26]]){delete _0xf542xe[_0x1172[61]][_0x1172[26]]};return MailAccount[_0x1172[52]](_0xf542xe[_0x1172[27]][_0x1172[26]])[_0x1172[19]](function(_0xf542x17){if(!_0xf542x17){return _0xf542xf[_0x1172[50]](404)};var _0xf542x1b=_[_0x1172[41]](_0xf542x17,_0xf542xe[_0x1172[61]]);return _0xf542x1b[_0x1172[66]]()})[_0x1172[19]](function(_0xf542x17){return _0xf542xf[_0x1172[18]](200)[_0x1172[17]](_0xf542x17)})[_0x1172[16]](sequelize.UniqueConstraintError,function(_0xf542x10){return Util[_0x1172[60]][_0x1172[59]](_0xf542xf,_0xf542x10)})[_0x1172[16]](function(_0xf542x10){return handleError(_0xf542xf,_0xf542x10)})};exports[_0x1172[67]]=function(_0xf542xe,_0xf542xf){if(_0xf542xe[_0x1172[61]][_0x1172[26]]){delete _0xf542xe[_0x1172[61]][_0x1172[26]]};return MailDisposition[_0x1172[52]](_0xf542xe[_0x1172[27]][_0x1172[68]])[_0x1172[19]](function(_0xf542x1c){if(!_0xf542x1c){return _0xf542xf[_0x1172[50]](404)};var _0xf542x1b=_[_0x1172[41]](_0xf542x1c,_0xf542xe[_0x1172[61]]);return _0xf542x1b[_0x1172[66]]()})[_0x1172[19]](function(_0xf542x17){return _0xf542xf[_0x1172[18]](200)[_0x1172[17]](_0xf542x17)})[_0x1172[16]](function(_0xf542x10){return handleError(_0xf542xf,_0xf542x10)})};exports[_0x1172[69]]=function(_0xf542xe,_0xf542xf){var _0xf542x1d=0;var _0xf542x1e=_0xf542xe[_0x1172[61]];_0xf542x1e[_0x1172[72]](function(_0xf542x1f){delete _0xf542x1f[_0x1172[26]];delete _0xf542x1f[_0x1172[70]];delete _0xf542x1f[_0x1172[32]];_0xf542x1f[_0x1172[71]]= ++_0xf542x1d});return sequelize[_0x1172[62]](function(_0xf542x19){return MailApplication[_0x1172[74]]({where:{MailAccountId:_0xf542xe[_0x1172[27]][_0x1172[26]]},individualHooks:true,transaction:_0xf542x19})[_0x1172[19]](function(_0xf542x21){return MailApplication[_0x1172[73]](_0xf542x1e,{individualHooks:true,transaction:_0xf542x19})})})[_0x1172[19]](function(_0xf542x20){return _0xf542xf[_0x1172[18]](200)[_0x1172[17]]({count:_0xf542x20[_0x1172[35]],rows:_0xf542x20})})[_0x1172[16]](function(_0xf542x10){return handleError(_0xf542xf,_0xf542x10)})};exports[_0x1172[74]]=function(_0xf542xe,_0xf542xf,_0xf542x12){return MailAccount[_0x1172[52]](_0xf542xe[_0x1172[27]][_0x1172[26]])[_0x1172[19]](function(_0xf542x17){if(!_0xf542x17){return _0xf542xf[_0x1172[50]](404)};return _0xf542x17[_0x1172[74]]()})[_0x1172[19]](function(){return _0xf542xf[_0x1172[50]](204)})[_0x1172[16]](function(_0xf542x10){return handleError(_0xf542xf,_0xf542x10)})};exports[_0x1172[75]]=function(_0xf542xe,_0xf542xf,_0xf542x12){return MailApplication[_0x1172[52]](_0xf542xe[_0x1172[27]][_0x1172[76]])[_0x1172[19]](function(_0xf542x21){if(!_0xf542x21){return _0xf542xf[_0x1172[50]](404)};return _0xf542x21[_0x1172[74]]()})[_0x1172[19]](function(){return _0xf542xf[_0x1172[50]](204)})[_0x1172[16]](function(_0xf542x10){return handleError(_0xf542xf,_0xf542x10)})};exports[_0x1172[77]]=function(_0xf542xe,_0xf542xf,_0xf542x12){return MailDisposition[_0x1172[52]](_0xf542xe[_0x1172[27]][_0x1172[68]])[_0x1172[19]](function(_0xf542x1a){if(!_0xf542x1a){return _0xf542xf[_0x1172[50]](404)};return _0xf542x1a[_0x1172[74]]()})[_0x1172[19]](function(){return _0xf542xf[_0x1172[50]](204)})[_0x1172[16]](function(_0xf542x10){return handleError(_0xf542xf,_0xf542x10)})};exports[_0x1172[78]]=function(_0xf542xe,_0xf542xf){return MailAccount[_0x1172[74]]({where:{id:_0xf542xe[_0x1172[20]][_0x1172[79]]},individualHooks:true})[_0x1172[19]](function(){return _0xf542xf[_0x1172[50]](204)})[_0x1172[16]](function(_0xf542x10){return handleError(_0xf542xf,_0xf542x10)})};exports[_0x1172[80]]=function(_0xf542xe,_0xf542xf){return MailApplication[_0x1172[74]]({where:{id:_0xf542xe[_0x1172[20]][_0x1172[79]]},individualHooks:true})[_0x1172[19]](function(){return _0xf542xf[_0x1172[50]](204)})[_0x1172[16]](function(_0xf542x10){return handleError(_0xf542xf,_0xf542x10)})};function handleError(_0xf542xf,_0xf542x10){return _0xf542xf[_0x1172[18]](500)[_0x1172[17]](_0xf542x10)}