a362352585d8a467232784da55b14f78b39f18c3
[motion.git] / server / api / mail_account / mail_account.controller.js
1 var _0xbc53=["\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","\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","\x70\x75\x73\x68","\x24\x61\x6E\x64","\x77\x68\x65\x72\x65","\x6D\x65\x72\x67\x65","\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","\x73\x68\x6F\x77","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\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","\x75\x70\x64\x61\x74\x65","\x73\x61\x76\x65","\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","\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"];_0xbc53[0];var _=require(_0xbc53[1]);var util=require(_0xbc53[2]);var async=require(_0xbc53[3]);var Util=require(_0xbc53[4]);var sequelize=require(_0xbc53[6])[_0xbc53[5]];var User=require(_0xbc53[6])[_0xbc53[7]];var MailQueue=require(_0xbc53[6])[_0xbc53[8]];var MailRoom=require(_0xbc53[6])[_0xbc53[9]];var MailAccount=require(_0xbc53[6])[_0xbc53[10]];var MailServerIn=require(_0xbc53[6])[_0xbc53[11]];var MailServerOut=require(_0xbc53[6])[_0xbc53[12]];var MailApplication=require(_0xbc53[6])[_0xbc53[13]];exports[_0xbc53[14]]=function(_0xcdf9xd,_0xcdf9xe){return MailAccount[_0xbc53[23]](_0xbc53[22])[_0xbc53[21]](Util[_0xbc53[20]](_0xcdf9xd[_0xbc53[19]]))[_0xbc53[18]](function(_0xcdf9x10){_0xcdf9xe[_0xbc53[17]](200)[_0xbc53[16]](_0xcdf9x10)})[_0xbc53[15]](function(_0xcdf9xf){return handleError(_0xcdf9xe,_0xcdf9xf)})};exports[_0xbc53[24]]=function(_0xcdf9xd,_0xcdf9xe,_0xcdf9x11){var _0xcdf9x12={where:{MailAccountId:_0xcdf9xd[_0xbc53[26]][_0xbc53[25]],$and:[]},attributes:[_0xbc53[25],_0xbc53[27],_0xbc53[28],_0xbc53[29],_0xbc53[30],_0xbc53[31]]};if(_0xcdf9xd[_0xbc53[19]]){if(_0xcdf9xd[_0xbc53[19]][_0xbc53[32]]){if(_[_0xbc53[33]](_0xcdf9xd[_0xbc53[19]][_0xbc53[32]])){for(var _0xcdf9x13=0;_0xcdf9x13<_0xcdf9xd[_0xbc53[19]][_0xbc53[32]][_0xbc53[34]];_0xcdf9x13++){_0xcdf9x12[_0xbc53[38]][_0xbc53[37]][_0xbc53[36]]({tags:{$like:_0xbc53[35]+_0xcdf9xd[_0xbc53[19]][_0xbc53[32]][_0xcdf9x13]+_0xbc53[35]}})}}else {_0xcdf9x12[_0xbc53[38]][_0xbc53[37]][_0xbc53[36]]({tags:{$like:_0xbc53[35]+_0xcdf9xd[_0xbc53[19]][_0xbc53[32]]+_0xbc53[35]}})};delete _0xcdf9xd[_0xbc53[19]][_0xbc53[32]]};_[_0xbc53[39]](_0xcdf9x12[_0xbc53[38]],_0xcdf9xd[_0xbc53[19]])};switch(_0xcdf9xd[_0xbc53[41]][_0xbc53[43]]){case _0xbc53[42]:_0xcdf9x12[_0xbc53[40]]=[{model:User,where:{id:_0xcdf9xd[_0xbc53[41]][_0xbc53[25]]}}];break;default:};return MailRoom[_0xbc53[45]](_0xcdf9x12)[_0xbc53[18]](function(_0xcdf9x14){return _0xcdf9xe[_0xbc53[17]](200)[_0xbc53[16]](_0xcdf9x14)})[_0xbc53[15]](function(_0xcdf9xf){console[_0xbc53[44]](_0xcdf9xf);return handleError(_0xcdf9xe,_0xcdf9xf)})};exports[_0xbc53[46]]=function(_0xcdf9xd,_0xcdf9xe,_0xcdf9x11){return MailAccount[_0xbc53[23]](_0xbc53[22])[_0xbc53[48]](_0xcdf9xd[_0xbc53[26]][_0xbc53[25]])[_0xbc53[18]](function(_0xcdf9x15){if(!_0xcdf9x15){return _0xcdf9xe[_0xbc53[47]](404)};return _0xcdf9xe[_0xbc53[16]](_0xcdf9x15)})[_0xbc53[15]](function(_0xcdf9xf){return handleError(_0xcdf9xe,_0xcdf9xf)})};exports[_0xbc53[49]]=function(_0xcdf9xd,_0xcdf9xe,_0xcdf9x11){return MailAccount[_0xbc53[23]](_0xbc53[22])[_0xbc53[48]](_0xcdf9xd[_0xbc53[26]][_0xbc53[25]])[_0xbc53[18]](function(_0xcdf9x15){if(!_0xcdf9x15){return _0xcdf9xe[_0xbc53[47]](404)};return _0xcdf9x15[_0xbc53[52]](_[_0xbc53[39]](Util[_0xbc53[20]](_0xcdf9xd[_0xbc53[19]]),{include:[{model:MailQueue,attributes:[_0xbc53[25],_0xbc53[50]]},{model:User,attributes:[_0xbc53[25],_0xbc53[50],_0xbc53[51]]}]}))})[_0xbc53[18]](function(_0xcdf9x16){return _0xcdf9xe[_0xbc53[16]]({count:_0xcdf9x16[_0xbc53[34]],rows:_0xcdf9x16})})[_0xbc53[15]](function(_0xcdf9xf){return handleError(_0xcdf9xe,_0xcdf9xf)})};exports[_0xbc53[53]]=function(_0xcdf9xd,_0xcdf9xe,_0xcdf9x11){return sequelize[_0xbc53[57]](function(_0xcdf9x17){return MailAccount[_0xbc53[53]](_0xcdf9xd[_0xbc53[56]],{include:[{model:MailServerIn},{model:MailServerOut}],transaction:_0xcdf9x17})})[_0xbc53[18]](function(_0xcdf9x15){return _0xcdf9xe[_0xbc53[17]](201)[_0xbc53[16]](_0xcdf9x15)})[_0xbc53[15]](sequelize.UniqueConstraintError,function(_0xcdf9xf){return Util[_0xbc53[55]][_0xbc53[54]](_0xcdf9xe,_0xcdf9xf)})[_0xbc53[15]](function(_0xcdf9xf){return handleError(_0xcdf9xe,_0xcdf9xf)})};exports[_0xbc53[58]]=function(_0xcdf9xd,_0xcdf9xe){if(_0xcdf9xd[_0xbc53[56]][_0xbc53[25]]){delete _0xcdf9xd[_0xbc53[56]][_0xbc53[25]]};return MailAccount[_0xbc53[48]](_0xcdf9xd[_0xbc53[26]][_0xbc53[25]])[_0xbc53[18]](function(_0xcdf9x15){if(!_0xcdf9x15){return _0xcdf9xe[_0xbc53[47]](404)};var _0xcdf9x18=_[_0xbc53[39]](_0xcdf9x15,_0xcdf9xd[_0xbc53[56]]);return _0xcdf9x18[_0xbc53[59]]()})[_0xbc53[18]](function(_0xcdf9x15){return _0xcdf9xe[_0xbc53[17]](200)[_0xbc53[16]](_0xcdf9x15)})[_0xbc53[15]](sequelize.UniqueConstraintError,function(_0xcdf9xf){return Util[_0xbc53[55]][_0xbc53[54]](_0xcdf9xe,_0xcdf9xf)})[_0xbc53[15]](function(_0xcdf9xf){return handleError(_0xcdf9xe,_0xcdf9xf)})};exports[_0xbc53[60]]=function(_0xcdf9xd,_0xcdf9xe){var _0xcdf9x19=0;var _0xcdf9x1a=_0xcdf9xd[_0xbc53[56]];_0xcdf9x1a[_0xbc53[63]](function(_0xcdf9x1b){delete _0xcdf9x1b[_0xbc53[25]];delete _0xcdf9x1b[_0xbc53[61]];delete _0xcdf9x1b[_0xbc53[31]];_0xcdf9x1b[_0xbc53[62]]= ++_0xcdf9x19});return sequelize[_0xbc53[57]](function(_0xcdf9x17){return MailApplication[_0xbc53[65]]({where:{MailAccountId:_0xcdf9xd[_0xbc53[26]][_0xbc53[25]]},individualHooks:true,transaction:_0xcdf9x17})[_0xbc53[18]](function(_0xcdf9x1d){return MailApplication[_0xbc53[64]](_0xcdf9x1a,{individualHooks:true,transaction:_0xcdf9x17})})})[_0xbc53[18]](function(_0xcdf9x1c){return _0xcdf9xe[_0xbc53[17]](200)[_0xbc53[16]]({count:_0xcdf9x1c[_0xbc53[34]],rows:_0xcdf9x1c})})[_0xbc53[15]](function(_0xcdf9xf){return handleError(_0xcdf9xe,_0xcdf9xf)})};exports[_0xbc53[65]]=function(_0xcdf9xd,_0xcdf9xe,_0xcdf9x11){return MailAccount[_0xbc53[48]](_0xcdf9xd[_0xbc53[26]][_0xbc53[25]])[_0xbc53[18]](function(_0xcdf9x15){if(!_0xcdf9x15){return _0xcdf9xe[_0xbc53[47]](404)};return _0xcdf9x15[_0xbc53[65]]()})[_0xbc53[18]](function(){return _0xcdf9xe[_0xbc53[47]](204)})[_0xbc53[15]](function(_0xcdf9xf){return handleError(_0xcdf9xe,_0xcdf9xf)})};exports[_0xbc53[66]]=function(_0xcdf9xd,_0xcdf9xe,_0xcdf9x11){return MailApplication[_0xbc53[48]](_0xcdf9xd[_0xbc53[26]][_0xbc53[67]])[_0xbc53[18]](function(_0xcdf9x1d){if(!_0xcdf9x1d){return _0xcdf9xe[_0xbc53[47]](404)};return _0xcdf9x1d[_0xbc53[65]]()})[_0xbc53[18]](function(){return _0xcdf9xe[_0xbc53[47]](204)})[_0xbc53[15]](function(_0xcdf9xf){return handleError(_0xcdf9xe,_0xcdf9xf)})};exports[_0xbc53[68]]=function(_0xcdf9xd,_0xcdf9xe){return MailAccount[_0xbc53[65]]({where:{id:_0xcdf9xd[_0xbc53[19]][_0xbc53[69]]},individualHooks:true})[_0xbc53[18]](function(){return _0xcdf9xe[_0xbc53[47]](204)})[_0xbc53[15]](function(_0xcdf9xf){return handleError(_0xcdf9xe,_0xcdf9xf)})};exports[_0xbc53[70]]=function(_0xcdf9xd,_0xcdf9xe){return MailApplication[_0xbc53[65]]({where:{id:_0xcdf9xd[_0xbc53[19]][_0xbc53[69]]},individualHooks:true})[_0xbc53[18]](function(){return _0xcdf9xe[_0xbc53[47]](204)})[_0xbc53[15]](function(_0xcdf9xf){return handleError(_0xcdf9xe,_0xcdf9xf)})};function handleError(_0xcdf9xe,_0xcdf9xf){return _0xcdf9xe[_0xbc53[17]](500)[_0xbc53[16]](_0xcdf9xf)}