Built motion from commit bfa6da2.|0.0.130
[motion.git] / server / config / automations / mail.js
index e013280..0450fda 100644 (file)
@@ -1 +1 @@
-var _0x7d70=["\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"];_0x7d70[0];var _=require(_0x7d70[1]);var config=require(_0x7d70[2]);var moment=require(_0x7d70[3]);var sequelize=require(_0x7d70[5])[_0x7d70[4]];var Automation=require(_0x7d70[5])[_0x7d70[6]];var MailRoom=require(_0x7d70[5])[_0x7d70[7]];var Settings=require(_0x7d70[5])[_0x7d70[8]];var activeMailAutomations={};function executeAutomation(_0x1785xa){console[_0x7d70[10]](_0x7d70[9],_0x1785xa);var _0x1785xb;return Automation[_0x7d70[30]](_0x7d70[29])[_0x7d70[28]](_0x1785xa)[_0x7d70[19]](function(_0x1785x10){_0x1785xb= _0x1785x10;var _0x1785x11={where:{$and:[],$or:[]}};_0x1785x10[_0x7d70[24]][_0x7d70[17]](function(_0x1785x12){_0x1785x11[_0x7d70[23]][_0x7d70[22]][_0x7d70[21]](getCondition(_0x1785x12[_0x7d70[20]]))});_0x1785x10[_0x7d70[26]][_0x7d70[17]](function(_0x1785x12){_0x1785x11[_0x7d70[23]][_0x7d70[25]][_0x7d70[21]](getCondition(_0x1785x12[_0x7d70[20]]))});return MailRoom[_0x7d70[27]](_0x1785x11)})[_0x7d70[19]](function(_0x1785xd){_0x1785xd[_0x7d70[17]](function(_0x1785xe){_0x1785xb[_0x7d70[18]][_0x7d70[17]](function(_0x1785xf){switch(_0x1785xf[_0x7d70[16]]){case _0x7d70[15]:setStatus(_0x1785xe[_0x7d70[13]],_0x1785xf[_0x7d70[14]]);break;default:}})})})[_0x7d70[12]](function(_0x1785xc){console[_0x7d70[10]](_0x7d70[11],_0x1785xc)})}function setStatus(_0x1785x14,_0x1785x15){return MailRoom[_0x7d70[32]]({status:_0x1785x15},{where:{id:_0x1785x14}})[_0x7d70[12]](function(_0x1785xc){console[_0x7d70[10]](_0x7d70[31],_0x1785xc)})}function getCondition(_0x1785x12){var _0x1785x17={};switch(_0x1785x12[_0x7d70[33]]){case _0x7d70[15]:switch(_0x1785x12[_0x7d70[37]]){case _0x7d70[35]:_0x1785x17[_0x1785x12[_0x7d70[33]]]= _0x1785x12[_0x7d70[34]];break;case _0x7d70[36]:_0x1785x17[_0x1785x12[_0x7d70[33]]]= {$ne:_0x1785x12[_0x7d70[34]]};break;default:};break;case _0x7d70[46]:var _0x1785x18=moment()[_0x7d70[41]](parseInt(_0x1785x12[_0x7d70[34]],10),_0x7d70[40])[_0x7d70[39]](_0x7d70[38]);switch(_0x1785x12[_0x7d70[37]]){case _0x7d70[42]:_0x1785x17[_0x1785x12[_0x7d70[33]]]= {lt:_0x1785x18};break;case _0x7d70[43]:_0x1785x17[_0x1785x12[_0x7d70[33]]]= {$lte:_0x1785x18};break;case _0x7d70[44]:_0x1785x17[_0x1785x12[_0x7d70[33]]]= {$gt:_0x1785x18};break;case _0x7d70[45]:_0x1785x17[_0x1785x12[_0x7d70[33]]]= {$gte:_0x1785x18};break;default:};break;default:};return _0x1785x17}function createInterval(_0x1785x10){console[_0x7d70[10]](_0x7d70[47],_0x1785x10[_0x7d70[13]],_0x7d70[48],_0x1785x10[_0x7d70[49]]* 60* 1000);activeMailAutomations[_0x7d70[50]+ _0x1785x10[_0x7d70[13]]]= setInterval(function(){executeAutomation(_0x1785x10[_0x7d70[13]])},_0x1785x10[_0x7d70[49]]* 60* 1000)}module[_0x7d70[51]]= function(){Automation[_0x7d70[55]](function(_0x1785x1a,_0x1785x1b){console[_0x7d70[10]](_0x7d70[47],_0x1785x1a[_0x7d70[13]],_0x7d70[52],_0x1785x1a[_0x7d70[15]]);if(_0x1785x1a[_0x7d70[15]]&& _0x1785x1a[_0x7d70[53]]=== _0x7d70[54]){createInterval(_0x1785x1a)}});Automation[_0x7d70[58]](function(_0x1785x1a,_0x1785x1b){console[_0x7d70[10]](_0x7d70[47],_0x1785x1a[_0x7d70[13]],_0x7d70[56],_0x1785x1a[_0x7d70[15]]);if(activeMailAutomations[_0x7d70[50]+ _0x1785x1a[_0x7d70[13]]]){console[_0x7d70[10]](_0x7d70[57],_0x1785x1a[_0x7d70[13]]);clearInterval(activeMailAutomations[_0x7d70[50]+ _0x1785x1a[_0x7d70[13]]]);delete activeMailAutomations[_0x7d70[50]+ _0x1785x1a[_0x7d70[13]]]};if(_0x1785x1a[_0x7d70[15]]&& _0x1785x1a[_0x7d70[53]]=== _0x7d70[54]){createInterval(_0x1785x1a)}});Automation[_0x7d70[60]](function(_0x1785x1a,_0x1785x1b){console[_0x7d70[10]](_0x7d70[47],_0x1785x1a[_0x7d70[13]],_0x7d70[59]);if(activeMailAutomations[_0x7d70[50]+ _0x1785x1a[_0x7d70[13]]]){console[_0x7d70[10]](_0x7d70[57],_0x1785x1a[_0x7d70[13]]);clearInterval(activeMailAutomations[_0x7d70[50]+ _0x1785x1a[_0x7d70[13]]]);delete activeMailAutomations[_0x7d70[50]+ _0x1785x1a[_0x7d70[13]]]}});return Automation[_0x7d70[30]](_0x7d70[29])[_0x7d70[27]]({where:{status:true,channel:_0x7d70[54]},attributes:[_0x7d70[13],_0x7d70[49]]})[_0x7d70[19]](function(_0x1785x1c){_0x1785x1c[_0x7d70[17]](function(_0x1785x10){createInterval(_0x1785x10)})})[_0x7d70[12]](function(_0x1785xc){console[_0x7d70[10]](_0x7d70[61],_0x1785xc)})}
\ No newline at end of file
+var _0x8662=["\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"];_0x8662[0];var _=require(_0x8662[1]);var config=require(_0x8662[2]);var moment=require(_0x8662[3]);var sequelize=require(_0x8662[5])[_0x8662[4]];var Automation=require(_0x8662[5])[_0x8662[6]];var MailRoom=require(_0x8662[5])[_0x8662[7]];var activeMailAutomations={};function executeAutomation(_0x2f24x9){console[_0x8662[9]](_0x8662[8],_0x2f24x9);var _0x2f24xa;return Automation[_0x8662[30]](_0x8662[29])[_0x8662[28]](_0x2f24x9)[_0x8662[18]](function(_0x2f24xf){_0x2f24xa= _0x2f24xf;var _0x2f24x10=[];var _0x2f24x11=[];var _0x2f24x12={where:{}};_0x2f24xf[_0x8662[21]][_0x8662[16]](function(_0x2f24x13){_0x2f24x11[_0x8662[20]](getCondition(_0x2f24x13[_0x8662[19]]))});_0x2f24xf[_0x8662[22]][_0x8662[16]](function(_0x2f24x13){_0x2f24x10[_0x8662[20]](getCondition(_0x2f24x13[_0x8662[19]]))});if(_0x2f24x11[_0x8662[23]]){_0x2f24x12[_0x8662[25]][_0x8662[24]]= _0x2f24x11};if(_0x2f24x10[_0x8662[23]]){_0x2f24x12[_0x8662[25]][_0x8662[26]]= _0x2f24x10};return MailRoom[_0x8662[27]](_0x2f24x12)})[_0x8662[18]](function(_0x2f24xc){_0x2f24xc[_0x8662[16]](function(_0x2f24xd){_0x2f24xa[_0x8662[17]][_0x8662[16]](function(_0x2f24xe){switch(_0x2f24xe[_0x8662[15]]){case _0x8662[14]:setStatus(_0x2f24xd[_0x8662[12]],_0x2f24xe[_0x8662[13]]);break;default:}})})})[_0x8662[11]](function(_0x2f24xb){console[_0x8662[9]](_0x8662[10],_0x2f24xb)})}function setStatus(_0x2f24x15,_0x2f24x16){return MailRoom[_0x8662[32]]({status:_0x2f24x16},{where:{id:_0x2f24x15}})[_0x8662[11]](function(_0x2f24xb){console[_0x8662[9]](_0x8662[31],_0x2f24xb)})}function getCondition(_0x2f24x13){var _0x2f24x18={};switch(_0x2f24x13[_0x8662[33]]){case _0x8662[14]:switch(_0x2f24x13[_0x8662[37]]){case _0x8662[35]:_0x2f24x18[_0x2f24x13[_0x8662[33]]]= _0x2f24x13[_0x8662[34]];break;case _0x8662[36]:_0x2f24x18[_0x2f24x13[_0x8662[33]]]= {$ne:_0x2f24x13[_0x8662[34]]};break;default:};break;case _0x8662[46]:var _0x2f24x19=moment()[_0x8662[41]](parseInt(_0x2f24x13[_0x8662[34]],10),_0x8662[40])[_0x8662[39]](_0x8662[38]);switch(_0x2f24x13[_0x8662[37]]){case _0x8662[42]:_0x2f24x18[_0x2f24x13[_0x8662[33]]]= {lt:_0x2f24x19};break;case _0x8662[43]:_0x2f24x18[_0x2f24x13[_0x8662[33]]]= {$lte:_0x2f24x19};break;case _0x8662[44]:_0x2f24x18[_0x2f24x13[_0x8662[33]]]= {$gt:_0x2f24x19};break;case _0x8662[45]:_0x2f24x18[_0x2f24x13[_0x8662[33]]]= {$gte:_0x2f24x19};break;default:};break;default:};return _0x2f24x18}function createInterval(_0x2f24xf){console[_0x8662[9]](_0x8662[47],_0x2f24xf[_0x8662[12]],_0x8662[48],_0x2f24xf[_0x8662[49]]* 60* 1000);activeMailAutomations[_0x8662[50]+ _0x2f24xf[_0x8662[12]]]= setInterval(function(){executeAutomation(_0x2f24xf[_0x8662[12]])},_0x2f24xf[_0x8662[49]]* 60* 1000)}module[_0x8662[51]]= function(){Automation[_0x8662[55]](function(_0x2f24x1b,_0x2f24x1c){console[_0x8662[9]](_0x8662[47],_0x2f24x1b[_0x8662[12]],_0x8662[52],_0x2f24x1b[_0x8662[14]]);if(_0x2f24x1b[_0x8662[14]]&& _0x2f24x1b[_0x8662[53]]=== _0x8662[54]){createInterval(_0x2f24x1b)}});Automation[_0x8662[58]](function(_0x2f24x1b,_0x2f24x1c){console[_0x8662[9]](_0x8662[47],_0x2f24x1b[_0x8662[12]],_0x8662[56],_0x2f24x1b[_0x8662[14]]);if(activeMailAutomations[_0x8662[50]+ _0x2f24x1b[_0x8662[12]]]){console[_0x8662[9]](_0x8662[57],_0x2f24x1b[_0x8662[12]]);clearInterval(activeMailAutomations[_0x8662[50]+ _0x2f24x1b[_0x8662[12]]]);delete activeMailAutomations[_0x8662[50]+ _0x2f24x1b[_0x8662[12]]]};if(_0x2f24x1b[_0x8662[14]]&& _0x2f24x1b[_0x8662[53]]=== _0x8662[54]){createInterval(_0x2f24x1b)}});Automation[_0x8662[60]](function(_0x2f24x1b,_0x2f24x1c){console[_0x8662[9]](_0x8662[47],_0x2f24x1b[_0x8662[12]],_0x8662[59]);if(activeMailAutomations[_0x8662[50]+ _0x2f24x1b[_0x8662[12]]]){console[_0x8662[9]](_0x8662[57],_0x2f24x1b[_0x8662[12]]);clearInterval(activeMailAutomations[_0x8662[50]+ _0x2f24x1b[_0x8662[12]]]);delete activeMailAutomations[_0x8662[50]+ _0x2f24x1b[_0x8662[12]]]}});return Automation[_0x8662[30]](_0x8662[29])[_0x8662[27]]({where:{status:true,channel:_0x8662[54]},attributes:[_0x8662[12],_0x8662[49]]})[_0x8662[18]](function(_0x2f24x1d){_0x2f24x1d[_0x8662[16]](function(_0x2f24xf){createInterval(_0x2f24xf)})})[_0x8662[11]](function(_0x2f24xb){console[_0x8662[9]](_0x8662[61],_0x2f24xb)})}
\ No newline at end of file