Built motion from commit 0dbf6b8.|0.0.131
[motion.git] / server / config / automations / mail.js
index b4f48f6..1bdcb70 100644 (file)
@@ -1 +1 @@
-var _0x30ee=["\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"];_0x30ee[0];var _=require(_0x30ee[1]);var config=require(_0x30ee[2]);var moment=require(_0x30ee[3]);var sequelize=require(_0x30ee[5])[_0x30ee[4]];var Automation=require(_0x30ee[5])[_0x30ee[6]];var MailRoom=require(_0x30ee[5])[_0x30ee[7]];var Settings=require(_0x30ee[5])[_0x30ee[8]];var activeMailAutomations={};function executeAutomation(_0x7261xa){console[_0x30ee[10]](_0x30ee[9],_0x7261xa);var _0x7261xb;return Automation[_0x30ee[30]](_0x30ee[29])[_0x30ee[28]](_0x7261xa)[_0x30ee[19]](function(_0x7261x10){_0x7261xb= _0x7261x10;var _0x7261x11={where:{$and:[],$or:[]}};_0x7261x10[_0x30ee[24]][_0x30ee[17]](function(_0x7261x12){_0x7261x11[_0x30ee[23]][_0x30ee[22]][_0x30ee[21]](getCondition(_0x7261x12[_0x30ee[20]]))});_0x7261x10[_0x30ee[26]][_0x30ee[17]](function(_0x7261x12){_0x7261x11[_0x30ee[23]][_0x30ee[25]][_0x30ee[21]](getCondition(_0x7261x12[_0x30ee[20]]))});return MailRoom[_0x30ee[27]](_0x7261x11)})[_0x30ee[19]](function(_0x7261xd){_0x7261xd[_0x30ee[17]](function(_0x7261xe){_0x7261xb[_0x30ee[18]][_0x30ee[17]](function(_0x7261xf){switch(_0x7261xf[_0x30ee[16]]){case _0x30ee[15]:setStatus(_0x7261xe[_0x30ee[13]],_0x7261xf[_0x30ee[14]]);break;default:}})})})[_0x30ee[12]](function(_0x7261xc){console[_0x30ee[10]](_0x30ee[11],_0x7261xc)})}function setStatus(_0x7261x14,_0x7261x15){return MailRoom[_0x30ee[32]]({status:_0x7261x15},{where:{id:_0x7261x14}})[_0x30ee[12]](function(_0x7261xc){console[_0x30ee[10]](_0x30ee[31],_0x7261xc)})}function getCondition(_0x7261x12){var _0x7261x17={};switch(_0x7261x12[_0x30ee[33]]){case _0x30ee[15]:switch(_0x7261x12[_0x30ee[37]]){case _0x30ee[35]:_0x7261x17[_0x7261x12[_0x30ee[33]]]= _0x7261x12[_0x30ee[34]];break;case _0x30ee[36]:_0x7261x17[_0x7261x12[_0x30ee[33]]]= {$ne:_0x7261x12[_0x30ee[34]]};break;default:};break;case _0x30ee[46]:var _0x7261x18=moment()[_0x30ee[41]](parseInt(_0x7261x12[_0x30ee[34]],10),_0x30ee[40])[_0x30ee[39]](_0x30ee[38]);switch(_0x7261x12[_0x30ee[37]]){case _0x30ee[42]:_0x7261x17[_0x7261x12[_0x30ee[33]]]= {lt:_0x7261x18};break;case _0x30ee[43]:_0x7261x17[_0x7261x12[_0x30ee[33]]]= {$lte:_0x7261x18};break;case _0x30ee[44]:_0x7261x17[_0x7261x12[_0x30ee[33]]]= {$gt:_0x7261x18};break;case _0x30ee[45]:_0x7261x17[_0x7261x12[_0x30ee[33]]]= {$gte:_0x7261x18};break;default:};break;default:};return _0x7261x17}function createInterval(_0x7261x10){console[_0x30ee[10]](_0x30ee[47],_0x7261x10[_0x30ee[13]],_0x30ee[48],_0x7261x10[_0x30ee[49]]* 60* 1000);activeMailAutomations[_0x30ee[50]+ _0x7261x10[_0x30ee[13]]]= setInterval(function(){executeAutomation(_0x7261x10[_0x30ee[13]])},_0x7261x10[_0x30ee[49]]* 60* 1000)}module[_0x30ee[51]]= function(){Automation[_0x30ee[55]](function(_0x7261x1a,_0x7261x1b){console[_0x30ee[10]](_0x30ee[47],_0x7261x1a[_0x30ee[13]],_0x30ee[52],_0x7261x1a[_0x30ee[15]]);if(_0x7261x1a[_0x30ee[15]]&& _0x7261x1a[_0x30ee[53]]=== _0x30ee[54]){createInterval(_0x7261x1a)}});Automation[_0x30ee[58]](function(_0x7261x1a,_0x7261x1b){console[_0x30ee[10]](_0x30ee[47],_0x7261x1a[_0x30ee[13]],_0x30ee[56],_0x7261x1a[_0x30ee[15]]);if(activeMailAutomations[_0x30ee[50]+ _0x7261x1a[_0x30ee[13]]]){console[_0x30ee[10]](_0x30ee[57],_0x7261x1a[_0x30ee[13]]);clearInterval(activeMailAutomations[_0x30ee[50]+ _0x7261x1a[_0x30ee[13]]]);delete activeMailAutomations[_0x30ee[50]+ _0x7261x1a[_0x30ee[13]]]};if(_0x7261x1a[_0x30ee[15]]&& _0x7261x1a[_0x30ee[53]]=== _0x30ee[54]){createInterval(_0x7261x1a)}});Automation[_0x30ee[60]](function(_0x7261x1a,_0x7261x1b){console[_0x30ee[10]](_0x30ee[47],_0x7261x1a[_0x30ee[13]],_0x30ee[59]);if(activeMailAutomations[_0x30ee[50]+ _0x7261x1a[_0x30ee[13]]]){console[_0x30ee[10]](_0x30ee[57],_0x7261x1a[_0x30ee[13]]);clearInterval(activeMailAutomations[_0x30ee[50]+ _0x7261x1a[_0x30ee[13]]]);delete activeMailAutomations[_0x30ee[50]+ _0x7261x1a[_0x30ee[13]]]}});return Automation[_0x30ee[30]](_0x30ee[29])[_0x30ee[27]]({where:{status:true,channel:_0x30ee[54]},attributes:[_0x30ee[13],_0x30ee[49]]})[_0x30ee[19]](function(_0x7261x1c){_0x7261x1c[_0x30ee[17]](function(_0x7261x10){createInterval(_0x7261x10)})})[_0x30ee[12]](function(_0x7261xc){console[_0x30ee[10]](_0x30ee[61],_0x7261xc)})}
\ No newline at end of file
+var _0x46be=["\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","\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","\x41\x6C\x6C","\x41\x6E\x79","\x6C\x65\x6E\x67\x74\x68","\x24\x61\x6E\x64","\x77\x68\x65\x72\x65","\x24\x6F\x72","\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"];_0x46be[0];var _=require(_0x46be[1]);var config=require(_0x46be[2]);var moment=require(_0x46be[3]);var sequelize=require(_0x46be[5])[_0x46be[4]];var Automation=require(_0x46be[5])[_0x46be[6]];var MailRoom=require(_0x46be[5])[_0x46be[7]];var activeMailAutomations={};function executeAutomation(_0xe515x9){console[_0x46be[9]](_0x46be[8],_0xe515x9);var _0xe515xa;return Automation[_0x46be[30]](_0x46be[29])[_0x46be[28]](_0xe515x9)[_0x46be[18]](function(_0xe515xf){_0xe515xa= _0xe515xf;var _0xe515x10=[];var _0xe515x11=[];var _0xe515x12={where:{}};_0xe515xf[_0x46be[21]][_0x46be[16]](function(_0xe515x13){_0xe515x11[_0x46be[20]](getCondition(_0xe515x13[_0x46be[19]]))});_0xe515xf[_0x46be[22]][_0x46be[16]](function(_0xe515x13){_0xe515x10[_0x46be[20]](getCondition(_0xe515x13[_0x46be[19]]))});if(_0xe515x11[_0x46be[23]]){_0xe515x12[_0x46be[25]][_0x46be[24]]= _0xe515x11};if(_0xe515x10[_0x46be[23]]){_0xe515x12[_0x46be[25]][_0x46be[26]]= _0xe515x10};return MailRoom[_0x46be[27]](_0xe515x12)})[_0x46be[18]](function(_0xe515xc){_0xe515xc[_0x46be[16]](function(_0xe515xd){_0xe515xa[_0x46be[17]][_0x46be[16]](function(_0xe515xe){switch(_0xe515xe[_0x46be[15]]){case _0x46be[14]:setStatus(_0xe515xd[_0x46be[12]],_0xe515xe[_0x46be[13]]);break;default:}})})})[_0x46be[11]](function(_0xe515xb){console[_0x46be[9]](_0x46be[10],_0xe515xb)})}function setStatus(_0xe515x15,_0xe515x16){return MailRoom[_0x46be[32]]({status:_0xe515x16},{where:{id:_0xe515x15}})[_0x46be[11]](function(_0xe515xb){console[_0x46be[9]](_0x46be[31],_0xe515xb)})}function getCondition(_0xe515x13){var _0xe515x18={};switch(_0xe515x13[_0x46be[33]]){case _0x46be[14]:switch(_0xe515x13[_0x46be[37]]){case _0x46be[35]:_0xe515x18[_0xe515x13[_0x46be[33]]]= _0xe515x13[_0x46be[34]];break;case _0x46be[36]:_0xe515x18[_0xe515x13[_0x46be[33]]]= {$ne:_0xe515x13[_0x46be[34]]};break;default:};break;case _0x46be[46]:var _0xe515x19=moment()[_0x46be[41]](parseInt(_0xe515x13[_0x46be[34]],10),_0x46be[40])[_0x46be[39]](_0x46be[38]);switch(_0xe515x13[_0x46be[37]]){case _0x46be[42]:_0xe515x18[_0xe515x13[_0x46be[33]]]= {lt:_0xe515x19};break;case _0x46be[43]:_0xe515x18[_0xe515x13[_0x46be[33]]]= {$lte:_0xe515x19};break;case _0x46be[44]:_0xe515x18[_0xe515x13[_0x46be[33]]]= {$gt:_0xe515x19};break;case _0x46be[45]:_0xe515x18[_0xe515x13[_0x46be[33]]]= {$gte:_0xe515x19};break;default:};break;default:};return _0xe515x18}function createInterval(_0xe515xf){console[_0x46be[9]](_0x46be[47],_0xe515xf[_0x46be[12]],_0x46be[48],_0xe515xf[_0x46be[49]]* 60* 1000);activeMailAutomations[_0x46be[50]+ _0xe515xf[_0x46be[12]]]= setInterval(function(){executeAutomation(_0xe515xf[_0x46be[12]])},_0xe515xf[_0x46be[49]]* 60* 1000)}module[_0x46be[51]]= function(){Automation[_0x46be[55]](function(_0xe515x1b,_0xe515x1c){console[_0x46be[9]](_0x46be[47],_0xe515x1b[_0x46be[12]],_0x46be[52],_0xe515x1b[_0x46be[14]]);if(_0xe515x1b[_0x46be[14]]&& _0xe515x1b[_0x46be[53]]=== _0x46be[54]){createInterval(_0xe515x1b)}});Automation[_0x46be[58]](function(_0xe515x1b,_0xe515x1c){console[_0x46be[9]](_0x46be[47],_0xe515x1b[_0x46be[12]],_0x46be[56],_0xe515x1b[_0x46be[14]]);if(activeMailAutomations[_0x46be[50]+ _0xe515x1b[_0x46be[12]]]){console[_0x46be[9]](_0x46be[57],_0xe515x1b[_0x46be[12]]);clearInterval(activeMailAutomations[_0x46be[50]+ _0xe515x1b[_0x46be[12]]]);delete activeMailAutomations[_0x46be[50]+ _0xe515x1b[_0x46be[12]]]};if(_0xe515x1b[_0x46be[14]]&& _0xe515x1b[_0x46be[53]]=== _0x46be[54]){createInterval(_0xe515x1b)}});Automation[_0x46be[60]](function(_0xe515x1b,_0xe515x1c){console[_0x46be[9]](_0x46be[47],_0xe515x1b[_0x46be[12]],_0x46be[59]);if(activeMailAutomations[_0x46be[50]+ _0xe515x1b[_0x46be[12]]]){console[_0x46be[9]](_0x46be[57],_0xe515x1b[_0x46be[12]]);clearInterval(activeMailAutomations[_0x46be[50]+ _0xe515x1b[_0x46be[12]]]);delete activeMailAutomations[_0x46be[50]+ _0xe515x1b[_0x46be[12]]]}});return Automation[_0x46be[30]](_0x46be[29])[_0x46be[27]]({where:{status:true,channel:_0x46be[54]},attributes:[_0x46be[12],_0x46be[49]]})[_0x46be[18]](function(_0xe515x1d){_0xe515x1d[_0x46be[16]](function(_0xe515xf){createInterval(_0xe515xf)})})[_0x46be[11]](function(_0xe515xb){console[_0x46be[9]](_0x46be[61],_0xe515xb)})}
\ No newline at end of file