Built motion from commit 3594e56.|0.0.120
[motion.git] / server / config / automations / mail.js
index 18ed4a4..3d9036a 100644 (file)
@@ -1 +1 @@
-var _0xb39f=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x2E\x2E\x2F\x65\x6E\x76\x69\x72\x6F\x6E\x6D\x65\x6E\x74","\x6D\x6F\x6D\x65\x6E\x74","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x41\x75\x74\x6F\x6D\x61\x74\x69\x6F\x6E","\x4D\x61\x69\x6C\x52\x6F\x6F\x6D","\x53\x65\x74\x74\x69\x6E\x67\x73","\x45\x78\x65\x63\x75\x74\x69\x6E\x67\x20\x4D\x61\x69\x6C\x20\x41\x75\x74\x6F\x6D\x61\x74\x69\x6F\x6E\x20","\x6C\x6F\x67","\x4D\x61\x69\x6C\x20\x41\x75\x74\x6F\x6D\x61\x74\x69\x6F\x6E\x20\x65\x78\x65\x63\x20\x65\x72\x72\x6F\x72","\x63\x61\x74\x63\x68","\x69\x64","\x64\x61\x74\x61\x31","\x73\x74\x61\x74\x75\x73","\x61\x63\x74\x69\x6F\x6E","\x66\x6F\x72\x45\x61\x63\x68","\x41\x63\x74\x69\x6F\x6E\x73","\x74\x68\x65\x6E","\x64\x61\x74\x61\x56\x61\x6C\x75\x65\x73","\x70\x75\x73\x68","\x24\x61\x6E\x64","\x77\x68\x65\x72\x65","\x41\x6C\x6C","\x24\x6F\x72","\x41\x6E\x79","\x66\x69\x6E\x64\x41\x6C\x6C","\x66\x69\x6E\x64\x42\x79\x49\x64","\x61\x6C\x6C","\x73\x63\x6F\x70\x65","\x41\x75\x74\x6F\x6D\x61\x74\x69\x63\x20\x6D\x61\x69\x6C\x20\x73\x74\x61\x74\x75\x73\x20\x65\x72\x72\x6F\x72","\x75\x70\x64\x61\x74\x65","\x66\x69\x65\x6C\x64","\x76\x61\x6C\x75\x65","\x65\x71\x75\x61\x6C\x73","\x6E\x6F\x74\x5F\x65\x71\x75\x61\x6C\x73","\x6F\x70\x65\x72\x61\x74\x6F\x72","\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","\x68\x6F\x75\x72\x73","\x73\x75\x62\x74\x72\x61\x63\x74","\x67\x72\x65\x61\x74\x65\x72","\x67\x72\x65\x61\x74\x65\x72\x5F\x6F\x72\x5F\x65\x71\x75\x61\x6C","\x6C\x65\x73\x73","\x6C\x65\x73\x73\x5F\x6F\x72\x5F\x65\x71\x75\x61\x6C","\x63\x72\x65\x61\x74\x65\x64\x41\x74","\x4D\x61\x69\x6C\x20\x41\x75\x74\x6F\x6D\x61\x74\x69\x6F\x6E\x20","\x20\x73\x65\x74\x20\x77\x69\x74\x68\x20\x74\x69\x6D\x65\x6F\x75\x74\x20","\x74\x69\x6D\x65\x6F\x75\x74","\x69\x6E\x74\x65\x72\x76\x61\x6C","\x65\x78\x70\x6F\x72\x74\x73","\x20\x63\x72\x65\x61\x74\x65\x64\x2C\x20\x74\x68\x65\x20\x73\x74\x61\x74\x75\x73\x20\x69\x73\x20","\x63\x68\x61\x6E\x6E\x65\x6C","\x6D\x61\x69\x6C","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x20\x75\x70\x64\x61\x74\x65\x64\x2C\x20\x74\x68\x65\x20\x73\x74\x61\x74\x75\x73\x20\x69\x73\x20","\x4D\x61\x69\x6C\x20\x61\x75\x74\x6F\x6D\x61\x74\x69\x6F\x6E\x20\x75\x6E\x73\x65\x74\x20","\x61\x66\x74\x65\x72\x55\x70\x64\x61\x74\x65","\x20\x64\x65\x6C\x65\x74\x65\x64","\x61\x66\x74\x65\x72\x44\x65\x6C\x65\x74\x65","\x4D\x61\x69\x6C\x20\x41\x75\x74\x6F\x6D\x61\x74\x69\x6F\x6E\x20\x69\x6E\x69\x74\x20\x65\x72\x72\x6F\x72"];_0xb39f[0];var _=require(_0xb39f[1]);var config=require(_0xb39f[2]);var moment=require(_0xb39f[3]);var sequelize=require(_0xb39f[5])[_0xb39f[4]];var Automation=require(_0xb39f[5])[_0xb39f[6]];var MailRoom=require(_0xb39f[5])[_0xb39f[7]];var Settings=require(_0xb39f[5])[_0xb39f[8]];var activeMailAutomations={};function executeAutomation(_0x69e5xa){console[_0xb39f[10]](_0xb39f[9],_0x69e5xa);var _0x69e5xb;return Automation[_0xb39f[30]](_0xb39f[29])[_0xb39f[28]](_0x69e5xa)[_0xb39f[19]](function(_0x69e5x10){_0x69e5xb= _0x69e5x10;var _0x69e5x11={where:{$and:[],$or:[]}};_0x69e5x10[_0xb39f[24]][_0xb39f[17]](function(_0x69e5x12){_0x69e5x11[_0xb39f[23]][_0xb39f[22]][_0xb39f[21]](getCondition(_0x69e5x12[_0xb39f[20]]))});_0x69e5x10[_0xb39f[26]][_0xb39f[17]](function(_0x69e5x12){_0x69e5x11[_0xb39f[23]][_0xb39f[25]][_0xb39f[21]](getCondition(_0x69e5x12[_0xb39f[20]]))});return MailRoom[_0xb39f[27]](_0x69e5x11)})[_0xb39f[19]](function(_0x69e5xd){_0x69e5xd[_0xb39f[17]](function(_0x69e5xe){_0x69e5xb[_0xb39f[18]][_0xb39f[17]](function(_0x69e5xf){switch(_0x69e5xf[_0xb39f[16]]){case _0xb39f[15]:setStatus(_0x69e5xe[_0xb39f[13]],_0x69e5xf[_0xb39f[14]]);break;default:}})})})[_0xb39f[12]](function(_0x69e5xc){console[_0xb39f[10]](_0xb39f[11],_0x69e5xc)})}function setStatus(_0x69e5x14,_0x69e5x15){return MailRoom[_0xb39f[32]]({status:_0x69e5x15},{where:{id:_0x69e5x14}})[_0xb39f[12]](function(_0x69e5xc){console[_0xb39f[10]](_0xb39f[31],_0x69e5xc)})}function getCondition(_0x69e5x12){var _0x69e5x17={};switch(_0x69e5x12[_0xb39f[33]]){case _0xb39f[15]:switch(_0x69e5x12[_0xb39f[37]]){case _0xb39f[35]:_0x69e5x17[_0x69e5x12[_0xb39f[33]]]= _0x69e5x12[_0xb39f[34]];break;case _0xb39f[36]:_0x69e5x17[_0x69e5x12[_0xb39f[33]]]= {$ne:_0x69e5x12[_0xb39f[34]]};break;default:};break;case _0xb39f[46]:var _0x69e5x18=moment()[_0xb39f[41]](parseInt(_0x69e5x12[_0xb39f[34]],10),_0xb39f[40])[_0xb39f[39]](_0xb39f[38]);switch(_0x69e5x12[_0xb39f[37]]){case _0xb39f[42]:_0x69e5x17[_0x69e5x12[_0xb39f[33]]]= {lt:_0x69e5x18};break;case _0xb39f[43]:_0x69e5x17[_0x69e5x12[_0xb39f[33]]]= {$lte:_0x69e5x18};break;case _0xb39f[44]:_0x69e5x17[_0x69e5x12[_0xb39f[33]]]= {$gt:_0x69e5x18};break;case _0xb39f[45]:_0x69e5x17[_0x69e5x12[_0xb39f[33]]]= {$gte:_0x69e5x18};break;default:};break;default:};return _0x69e5x17}function createInterval(_0x69e5x10){console[_0xb39f[10]](_0xb39f[47],_0x69e5x10[_0xb39f[13]],_0xb39f[48],_0x69e5x10[_0xb39f[49]]* 60* 1000);activeMailAutomations[_0xb39f[50]+ _0x69e5x10[_0xb39f[13]]]= setInterval(function(){executeAutomation(_0x69e5x10[_0xb39f[13]])},_0x69e5x10[_0xb39f[49]]* 60* 1000)}module[_0xb39f[51]]= function(){Automation[_0xb39f[55]](function(_0x69e5x1a,_0x69e5x1b){console[_0xb39f[10]](_0xb39f[47],_0x69e5x1a[_0xb39f[13]],_0xb39f[52],_0x69e5x1a[_0xb39f[15]]);if(_0x69e5x1a[_0xb39f[15]]&& _0x69e5x1a[_0xb39f[53]]=== _0xb39f[54]){createInterval(_0x69e5x1a)}});Automation[_0xb39f[58]](function(_0x69e5x1a,_0x69e5x1b){console[_0xb39f[10]](_0xb39f[47],_0x69e5x1a[_0xb39f[13]],_0xb39f[56],_0x69e5x1a[_0xb39f[15]]);if(activeMailAutomations[_0xb39f[50]+ _0x69e5x1a[_0xb39f[13]]]){console[_0xb39f[10]](_0xb39f[57],_0x69e5x1a[_0xb39f[13]]);clearInterval(activeMailAutomations[_0xb39f[50]+ _0x69e5x1a[_0xb39f[13]]]);delete activeMailAutomations[_0xb39f[50]+ _0x69e5x1a[_0xb39f[13]]]};if(_0x69e5x1a[_0xb39f[15]]&& _0x69e5x1a[_0xb39f[53]]=== _0xb39f[54]){createInterval(_0x69e5x1a)}});Automation[_0xb39f[60]](function(_0x69e5x1a,_0x69e5x1b){console[_0xb39f[10]](_0xb39f[47],_0x69e5x1a[_0xb39f[13]],_0xb39f[59]);if(activeMailAutomations[_0xb39f[50]+ _0x69e5x1a[_0xb39f[13]]]){console[_0xb39f[10]](_0xb39f[57],_0x69e5x1a[_0xb39f[13]]);clearInterval(activeMailAutomations[_0xb39f[50]+ _0x69e5x1a[_0xb39f[13]]]);delete activeMailAutomations[_0xb39f[50]+ _0x69e5x1a[_0xb39f[13]]]}});return Automation[_0xb39f[30]](_0xb39f[29])[_0xb39f[27]]({where:{status:true,channel:_0xb39f[54]},attributes:[_0xb39f[13],_0xb39f[49]]})[_0xb39f[19]](function(_0x69e5x1c){_0x69e5x1c[_0xb39f[17]](function(_0x69e5x10){createInterval(_0x69e5x10)})})[_0xb39f[12]](function(_0x69e5xc){console[_0xb39f[10]](_0xb39f[61],_0x69e5xc)})}
\ No newline at end of file
+var _0x3ea9=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x2E\x2E\x2F\x65\x6E\x76\x69\x72\x6F\x6E\x6D\x65\x6E\x74","\x6D\x6F\x6D\x65\x6E\x74","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x41\x75\x74\x6F\x6D\x61\x74\x69\x6F\x6E","\x4D\x61\x69\x6C\x52\x6F\x6F\x6D","\x53\x65\x74\x74\x69\x6E\x67\x73","\x45\x78\x65\x63\x75\x74\x69\x6E\x67\x20\x4D\x61\x69\x6C\x20\x41\x75\x74\x6F\x6D\x61\x74\x69\x6F\x6E\x20","\x6C\x6F\x67","\x4D\x61\x69\x6C\x20\x41\x75\x74\x6F\x6D\x61\x74\x69\x6F\x6E\x20\x65\x78\x65\x63\x20\x65\x72\x72\x6F\x72","\x63\x61\x74\x63\x68","\x69\x64","\x64\x61\x74\x61\x31","\x73\x74\x61\x74\x75\x73","\x61\x63\x74\x69\x6F\x6E","\x66\x6F\x72\x45\x61\x63\x68","\x41\x63\x74\x69\x6F\x6E\x73","\x74\x68\x65\x6E","\x64\x61\x74\x61\x56\x61\x6C\x75\x65\x73","\x70\x75\x73\x68","\x24\x61\x6E\x64","\x77\x68\x65\x72\x65","\x41\x6C\x6C","\x24\x6F\x72","\x41\x6E\x79","\x66\x69\x6E\x64\x41\x6C\x6C","\x66\x69\x6E\x64\x42\x79\x49\x64","\x61\x6C\x6C","\x73\x63\x6F\x70\x65","\x41\x75\x74\x6F\x6D\x61\x74\x69\x63\x20\x6D\x61\x69\x6C\x20\x73\x74\x61\x74\x75\x73\x20\x65\x72\x72\x6F\x72","\x75\x70\x64\x61\x74\x65","\x66\x69\x65\x6C\x64","\x76\x61\x6C\x75\x65","\x65\x71\x75\x61\x6C\x73","\x6E\x6F\x74\x5F\x65\x71\x75\x61\x6C\x73","\x6F\x70\x65\x72\x61\x74\x6F\x72","\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","\x68\x6F\x75\x72\x73","\x73\x75\x62\x74\x72\x61\x63\x74","\x67\x72\x65\x61\x74\x65\x72","\x67\x72\x65\x61\x74\x65\x72\x5F\x6F\x72\x5F\x65\x71\x75\x61\x6C","\x6C\x65\x73\x73","\x6C\x65\x73\x73\x5F\x6F\x72\x5F\x65\x71\x75\x61\x6C","\x63\x72\x65\x61\x74\x65\x64\x41\x74","\x4D\x61\x69\x6C\x20\x41\x75\x74\x6F\x6D\x61\x74\x69\x6F\x6E\x20","\x20\x73\x65\x74\x20\x77\x69\x74\x68\x20\x74\x69\x6D\x65\x6F\x75\x74\x20","\x74\x69\x6D\x65\x6F\x75\x74","\x69\x6E\x74\x65\x72\x76\x61\x6C","\x65\x78\x70\x6F\x72\x74\x73","\x20\x63\x72\x65\x61\x74\x65\x64\x2C\x20\x74\x68\x65\x20\x73\x74\x61\x74\x75\x73\x20\x69\x73\x20","\x63\x68\x61\x6E\x6E\x65\x6C","\x6D\x61\x69\x6C","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x20\x75\x70\x64\x61\x74\x65\x64\x2C\x20\x74\x68\x65\x20\x73\x74\x61\x74\x75\x73\x20\x69\x73\x20","\x4D\x61\x69\x6C\x20\x61\x75\x74\x6F\x6D\x61\x74\x69\x6F\x6E\x20\x75\x6E\x73\x65\x74\x20","\x61\x66\x74\x65\x72\x55\x70\x64\x61\x74\x65","\x20\x64\x65\x6C\x65\x74\x65\x64","\x61\x66\x74\x65\x72\x44\x65\x6C\x65\x74\x65","\x4D\x61\x69\x6C\x20\x41\x75\x74\x6F\x6D\x61\x74\x69\x6F\x6E\x20\x69\x6E\x69\x74\x20\x65\x72\x72\x6F\x72"];_0x3ea9[0];var _=require(_0x3ea9[1]);var config=require(_0x3ea9[2]);var moment=require(_0x3ea9[3]);var sequelize=require(_0x3ea9[5])[_0x3ea9[4]];var Automation=require(_0x3ea9[5])[_0x3ea9[6]];var MailRoom=require(_0x3ea9[5])[_0x3ea9[7]];var Settings=require(_0x3ea9[5])[_0x3ea9[8]];var activeMailAutomations={};function executeAutomation(_0xd48exa){console[_0x3ea9[10]](_0x3ea9[9],_0xd48exa);var _0xd48exb;return Automation[_0x3ea9[30]](_0x3ea9[29])[_0x3ea9[28]](_0xd48exa)[_0x3ea9[19]](function(_0xd48ex10){_0xd48exb= _0xd48ex10;var _0xd48ex11={where:{$and:[],$or:[]}};_0xd48ex10[_0x3ea9[24]][_0x3ea9[17]](function(_0xd48ex12){_0xd48ex11[_0x3ea9[23]][_0x3ea9[22]][_0x3ea9[21]](getCondition(_0xd48ex12[_0x3ea9[20]]))});_0xd48ex10[_0x3ea9[26]][_0x3ea9[17]](function(_0xd48ex12){_0xd48ex11[_0x3ea9[23]][_0x3ea9[25]][_0x3ea9[21]](getCondition(_0xd48ex12[_0x3ea9[20]]))});return MailRoom[_0x3ea9[27]](_0xd48ex11)})[_0x3ea9[19]](function(_0xd48exd){_0xd48exd[_0x3ea9[17]](function(_0xd48exe){_0xd48exb[_0x3ea9[18]][_0x3ea9[17]](function(_0xd48exf){switch(_0xd48exf[_0x3ea9[16]]){case _0x3ea9[15]:setStatus(_0xd48exe[_0x3ea9[13]],_0xd48exf[_0x3ea9[14]]);break;default:}})})})[_0x3ea9[12]](function(_0xd48exc){console[_0x3ea9[10]](_0x3ea9[11],_0xd48exc)})}function setStatus(_0xd48ex14,_0xd48ex15){return MailRoom[_0x3ea9[32]]({status:_0xd48ex15},{where:{id:_0xd48ex14}})[_0x3ea9[12]](function(_0xd48exc){console[_0x3ea9[10]](_0x3ea9[31],_0xd48exc)})}function getCondition(_0xd48ex12){var _0xd48ex17={};switch(_0xd48ex12[_0x3ea9[33]]){case _0x3ea9[15]:switch(_0xd48ex12[_0x3ea9[37]]){case _0x3ea9[35]:_0xd48ex17[_0xd48ex12[_0x3ea9[33]]]= _0xd48ex12[_0x3ea9[34]];break;case _0x3ea9[36]:_0xd48ex17[_0xd48ex12[_0x3ea9[33]]]= {$ne:_0xd48ex12[_0x3ea9[34]]};break;default:};break;case _0x3ea9[46]:var _0xd48ex18=moment()[_0x3ea9[41]](parseInt(_0xd48ex12[_0x3ea9[34]],10),_0x3ea9[40])[_0x3ea9[39]](_0x3ea9[38]);switch(_0xd48ex12[_0x3ea9[37]]){case _0x3ea9[42]:_0xd48ex17[_0xd48ex12[_0x3ea9[33]]]= {lt:_0xd48ex18};break;case _0x3ea9[43]:_0xd48ex17[_0xd48ex12[_0x3ea9[33]]]= {$lte:_0xd48ex18};break;case _0x3ea9[44]:_0xd48ex17[_0xd48ex12[_0x3ea9[33]]]= {$gt:_0xd48ex18};break;case _0x3ea9[45]:_0xd48ex17[_0xd48ex12[_0x3ea9[33]]]= {$gte:_0xd48ex18};break;default:};break;default:};return _0xd48ex17}function createInterval(_0xd48ex10){console[_0x3ea9[10]](_0x3ea9[47],_0xd48ex10[_0x3ea9[13]],_0x3ea9[48],_0xd48ex10[_0x3ea9[49]]* 60* 1000);activeMailAutomations[_0x3ea9[50]+ _0xd48ex10[_0x3ea9[13]]]= setInterval(function(){executeAutomation(_0xd48ex10[_0x3ea9[13]])},_0xd48ex10[_0x3ea9[49]]* 60* 1000)}module[_0x3ea9[51]]= function(){Automation[_0x3ea9[55]](function(_0xd48ex1a,_0xd48ex1b){console[_0x3ea9[10]](_0x3ea9[47],_0xd48ex1a[_0x3ea9[13]],_0x3ea9[52],_0xd48ex1a[_0x3ea9[15]]);if(_0xd48ex1a[_0x3ea9[15]]&& _0xd48ex1a[_0x3ea9[53]]=== _0x3ea9[54]){createInterval(_0xd48ex1a)}});Automation[_0x3ea9[58]](function(_0xd48ex1a,_0xd48ex1b){console[_0x3ea9[10]](_0x3ea9[47],_0xd48ex1a[_0x3ea9[13]],_0x3ea9[56],_0xd48ex1a[_0x3ea9[15]]);if(activeMailAutomations[_0x3ea9[50]+ _0xd48ex1a[_0x3ea9[13]]]){console[_0x3ea9[10]](_0x3ea9[57],_0xd48ex1a[_0x3ea9[13]]);clearInterval(activeMailAutomations[_0x3ea9[50]+ _0xd48ex1a[_0x3ea9[13]]]);delete activeMailAutomations[_0x3ea9[50]+ _0xd48ex1a[_0x3ea9[13]]]};if(_0xd48ex1a[_0x3ea9[15]]&& _0xd48ex1a[_0x3ea9[53]]=== _0x3ea9[54]){createInterval(_0xd48ex1a)}});Automation[_0x3ea9[60]](function(_0xd48ex1a,_0xd48ex1b){console[_0x3ea9[10]](_0x3ea9[47],_0xd48ex1a[_0x3ea9[13]],_0x3ea9[59]);if(activeMailAutomations[_0x3ea9[50]+ _0xd48ex1a[_0x3ea9[13]]]){console[_0x3ea9[10]](_0x3ea9[57],_0xd48ex1a[_0x3ea9[13]]);clearInterval(activeMailAutomations[_0x3ea9[50]+ _0xd48ex1a[_0x3ea9[13]]]);delete activeMailAutomations[_0x3ea9[50]+ _0xd48ex1a[_0x3ea9[13]]]}});return Automation[_0x3ea9[30]](_0x3ea9[29])[_0x3ea9[27]]({where:{status:true,channel:_0x3ea9[54]},attributes:[_0x3ea9[13],_0x3ea9[49]]})[_0x3ea9[19]](function(_0xd48ex1c){_0xd48ex1c[_0x3ea9[17]](function(_0xd48ex10){createInterval(_0xd48ex10)})})[_0x3ea9[12]](function(_0xd48exc){console[_0x3ea9[10]](_0x3ea9[61],_0xd48exc)})}
\ No newline at end of file