Built motion from commit 2e74e5e.|0.0.138
[motion.git] / server / config / automations / mail.js
index 255d95a..6c85c0d 100644 (file)
@@ -1 +1 @@
-var _0xf859=["\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"];_0xf859[0];var _=require(_0xf859[1]);var config=require(_0xf859[2]);var moment=require(_0xf859[3]);var sequelize=require(_0xf859[5])[_0xf859[4]];var Automation=require(_0xf859[5])[_0xf859[6]];var MailRoom=require(_0xf859[5])[_0xf859[7]];var activeMailAutomations={};function executeAutomation(_0x6f3fx9){console[_0xf859[9]](_0xf859[8],_0x6f3fx9);var _0x6f3fxa;return Automation[_0xf859[30]](_0xf859[29])[_0xf859[28]](_0x6f3fx9)[_0xf859[18]](function(_0x6f3fxf){_0x6f3fxa= _0x6f3fxf;var _0x6f3fx10=[];var _0x6f3fx11=[];var _0x6f3fx12={where:{}};_0x6f3fxf[_0xf859[21]][_0xf859[16]](function(_0x6f3fx13){_0x6f3fx11[_0xf859[20]](getCondition(_0x6f3fx13[_0xf859[19]]))});_0x6f3fxf[_0xf859[22]][_0xf859[16]](function(_0x6f3fx13){_0x6f3fx10[_0xf859[20]](getCondition(_0x6f3fx13[_0xf859[19]]))});if(_0x6f3fx11[_0xf859[23]]){_0x6f3fx12[_0xf859[25]][_0xf859[24]]= _0x6f3fx11};if(_0x6f3fx10[_0xf859[23]]){_0x6f3fx12[_0xf859[25]][_0xf859[26]]= _0x6f3fx10};return MailRoom[_0xf859[27]](_0x6f3fx12)})[_0xf859[18]](function(_0x6f3fxc){_0x6f3fxc[_0xf859[16]](function(_0x6f3fxd){_0x6f3fxa[_0xf859[17]][_0xf859[16]](function(_0x6f3fxe){switch(_0x6f3fxe[_0xf859[15]]){case _0xf859[14]:setStatus(_0x6f3fxd[_0xf859[12]],_0x6f3fxe[_0xf859[13]]);break;default:}})})})[_0xf859[11]](function(_0x6f3fxb){console[_0xf859[9]](_0xf859[10],_0x6f3fxb)})}function setStatus(_0x6f3fx15,_0x6f3fx16){return MailRoom[_0xf859[32]]({status:_0x6f3fx16},{where:{id:_0x6f3fx15}})[_0xf859[11]](function(_0x6f3fxb){console[_0xf859[9]](_0xf859[31],_0x6f3fxb)})}function getCondition(_0x6f3fx13){var _0x6f3fx18={};switch(_0x6f3fx13[_0xf859[33]]){case _0xf859[14]:switch(_0x6f3fx13[_0xf859[37]]){case _0xf859[35]:_0x6f3fx18[_0x6f3fx13[_0xf859[33]]]= _0x6f3fx13[_0xf859[34]];break;case _0xf859[36]:_0x6f3fx18[_0x6f3fx13[_0xf859[33]]]= {$ne:_0x6f3fx13[_0xf859[34]]};break;default:};break;case _0xf859[46]:var _0x6f3fx19=moment()[_0xf859[41]](parseInt(_0x6f3fx13[_0xf859[34]],10),_0xf859[40])[_0xf859[39]](_0xf859[38]);switch(_0x6f3fx13[_0xf859[37]]){case _0xf859[42]:_0x6f3fx18[_0x6f3fx13[_0xf859[33]]]= {lt:_0x6f3fx19};break;case _0xf859[43]:_0x6f3fx18[_0x6f3fx13[_0xf859[33]]]= {$lte:_0x6f3fx19};break;case _0xf859[44]:_0x6f3fx18[_0x6f3fx13[_0xf859[33]]]= {$gt:_0x6f3fx19};break;case _0xf859[45]:_0x6f3fx18[_0x6f3fx13[_0xf859[33]]]= {$gte:_0x6f3fx19};break;default:};break;default:};return _0x6f3fx18}function createInterval(_0x6f3fxf){console[_0xf859[9]](_0xf859[47],_0x6f3fxf[_0xf859[12]],_0xf859[48],_0x6f3fxf[_0xf859[49]]* 60* 1000);activeMailAutomations[_0xf859[50]+ _0x6f3fxf[_0xf859[12]]]= setInterval(function(){executeAutomation(_0x6f3fxf[_0xf859[12]])},_0x6f3fxf[_0xf859[49]]* 60* 1000)}module[_0xf859[51]]= function(){Automation[_0xf859[55]](function(_0x6f3fx1b,_0x6f3fx1c){console[_0xf859[9]](_0xf859[47],_0x6f3fx1b[_0xf859[12]],_0xf859[52],_0x6f3fx1b[_0xf859[14]]);if(_0x6f3fx1b[_0xf859[14]]&& _0x6f3fx1b[_0xf859[53]]=== _0xf859[54]){createInterval(_0x6f3fx1b)}});Automation[_0xf859[58]](function(_0x6f3fx1b,_0x6f3fx1c){console[_0xf859[9]](_0xf859[47],_0x6f3fx1b[_0xf859[12]],_0xf859[56],_0x6f3fx1b[_0xf859[14]]);if(activeMailAutomations[_0xf859[50]+ _0x6f3fx1b[_0xf859[12]]]){console[_0xf859[9]](_0xf859[57],_0x6f3fx1b[_0xf859[12]]);clearInterval(activeMailAutomations[_0xf859[50]+ _0x6f3fx1b[_0xf859[12]]]);delete activeMailAutomations[_0xf859[50]+ _0x6f3fx1b[_0xf859[12]]]};if(_0x6f3fx1b[_0xf859[14]]&& _0x6f3fx1b[_0xf859[53]]=== _0xf859[54]){createInterval(_0x6f3fx1b)}});Automation[_0xf859[60]](function(_0x6f3fx1b,_0x6f3fx1c){console[_0xf859[9]](_0xf859[47],_0x6f3fx1b[_0xf859[12]],_0xf859[59]);if(activeMailAutomations[_0xf859[50]+ _0x6f3fx1b[_0xf859[12]]]){console[_0xf859[9]](_0xf859[57],_0x6f3fx1b[_0xf859[12]]);clearInterval(activeMailAutomations[_0xf859[50]+ _0x6f3fx1b[_0xf859[12]]]);delete activeMailAutomations[_0xf859[50]+ _0x6f3fx1b[_0xf859[12]]]}});return Automation[_0xf859[30]](_0xf859[29])[_0xf859[27]]({where:{status:true,channel:_0xf859[54]},attributes:[_0xf859[12],_0xf859[49]]})[_0xf859[18]](function(_0x6f3fx1d){_0x6f3fx1d[_0xf859[16]](function(_0x6f3fxf){createInterval(_0x6f3fxf)})})[_0xf859[11]](function(_0x6f3fxb){console[_0xf859[9]](_0xf859[61],_0x6f3fxb)})}
\ No newline at end of file
+var _0x6aca=["\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"];_0x6aca[0];var _=require(_0x6aca[1]);var config=require(_0x6aca[2]);var moment=require(_0x6aca[3]);var sequelize=require(_0x6aca[5])[_0x6aca[4]];var Automation=require(_0x6aca[5])[_0x6aca[6]];var MailRoom=require(_0x6aca[5])[_0x6aca[7]];var activeMailAutomations={};function executeAutomation(_0xb6ccx9){console[_0x6aca[9]](_0x6aca[8],_0xb6ccx9);var _0xb6ccxa;return Automation[_0x6aca[30]](_0x6aca[29])[_0x6aca[28]](_0xb6ccx9)[_0x6aca[18]](function(_0xb6ccxf){_0xb6ccxa= _0xb6ccxf;var _0xb6ccx10=[];var _0xb6ccx11=[];var _0xb6ccx12={where:{}};_0xb6ccxf[_0x6aca[21]][_0x6aca[16]](function(_0xb6ccx13){_0xb6ccx11[_0x6aca[20]](getCondition(_0xb6ccx13[_0x6aca[19]]))});_0xb6ccxf[_0x6aca[22]][_0x6aca[16]](function(_0xb6ccx13){_0xb6ccx10[_0x6aca[20]](getCondition(_0xb6ccx13[_0x6aca[19]]))});if(_0xb6ccx11[_0x6aca[23]]){_0xb6ccx12[_0x6aca[25]][_0x6aca[24]]= _0xb6ccx11};if(_0xb6ccx10[_0x6aca[23]]){_0xb6ccx12[_0x6aca[25]][_0x6aca[26]]= _0xb6ccx10};return MailRoom[_0x6aca[27]](_0xb6ccx12)})[_0x6aca[18]](function(_0xb6ccxc){_0xb6ccxc[_0x6aca[16]](function(_0xb6ccxd){_0xb6ccxa[_0x6aca[17]][_0x6aca[16]](function(_0xb6ccxe){switch(_0xb6ccxe[_0x6aca[15]]){case _0x6aca[14]:setStatus(_0xb6ccxd[_0x6aca[12]],_0xb6ccxe[_0x6aca[13]]);break;default:}})})})[_0x6aca[11]](function(_0xb6ccxb){console[_0x6aca[9]](_0x6aca[10],_0xb6ccxb)})}function setStatus(_0xb6ccx15,_0xb6ccx16){return MailRoom[_0x6aca[32]]({status:_0xb6ccx16},{where:{id:_0xb6ccx15}})[_0x6aca[11]](function(_0xb6ccxb){console[_0x6aca[9]](_0x6aca[31],_0xb6ccxb)})}function getCondition(_0xb6ccx13){var _0xb6ccx18={};switch(_0xb6ccx13[_0x6aca[33]]){case _0x6aca[14]:switch(_0xb6ccx13[_0x6aca[37]]){case _0x6aca[35]:_0xb6ccx18[_0xb6ccx13[_0x6aca[33]]]= _0xb6ccx13[_0x6aca[34]];break;case _0x6aca[36]:_0xb6ccx18[_0xb6ccx13[_0x6aca[33]]]= {$ne:_0xb6ccx13[_0x6aca[34]]};break;default:};break;case _0x6aca[46]:var _0xb6ccx19=moment()[_0x6aca[41]](parseInt(_0xb6ccx13[_0x6aca[34]],10),_0x6aca[40])[_0x6aca[39]](_0x6aca[38]);switch(_0xb6ccx13[_0x6aca[37]]){case _0x6aca[42]:_0xb6ccx18[_0xb6ccx13[_0x6aca[33]]]= {lt:_0xb6ccx19};break;case _0x6aca[43]:_0xb6ccx18[_0xb6ccx13[_0x6aca[33]]]= {$lte:_0xb6ccx19};break;case _0x6aca[44]:_0xb6ccx18[_0xb6ccx13[_0x6aca[33]]]= {$gt:_0xb6ccx19};break;case _0x6aca[45]:_0xb6ccx18[_0xb6ccx13[_0x6aca[33]]]= {$gte:_0xb6ccx19};break;default:};break;default:};return _0xb6ccx18}function createInterval(_0xb6ccxf){console[_0x6aca[9]](_0x6aca[47],_0xb6ccxf[_0x6aca[12]],_0x6aca[48],_0xb6ccxf[_0x6aca[49]]* 60* 1000);activeMailAutomations[_0x6aca[50]+ _0xb6ccxf[_0x6aca[12]]]= setInterval(function(){executeAutomation(_0xb6ccxf[_0x6aca[12]])},_0xb6ccxf[_0x6aca[49]]* 60* 1000)}module[_0x6aca[51]]= function(){Automation[_0x6aca[55]](function(_0xb6ccx1b,_0xb6ccx1c){console[_0x6aca[9]](_0x6aca[47],_0xb6ccx1b[_0x6aca[12]],_0x6aca[52],_0xb6ccx1b[_0x6aca[14]]);if(_0xb6ccx1b[_0x6aca[14]]&& _0xb6ccx1b[_0x6aca[53]]=== _0x6aca[54]){createInterval(_0xb6ccx1b)}});Automation[_0x6aca[58]](function(_0xb6ccx1b,_0xb6ccx1c){console[_0x6aca[9]](_0x6aca[47],_0xb6ccx1b[_0x6aca[12]],_0x6aca[56],_0xb6ccx1b[_0x6aca[14]]);if(activeMailAutomations[_0x6aca[50]+ _0xb6ccx1b[_0x6aca[12]]]){console[_0x6aca[9]](_0x6aca[57],_0xb6ccx1b[_0x6aca[12]]);clearInterval(activeMailAutomations[_0x6aca[50]+ _0xb6ccx1b[_0x6aca[12]]]);delete activeMailAutomations[_0x6aca[50]+ _0xb6ccx1b[_0x6aca[12]]]};if(_0xb6ccx1b[_0x6aca[14]]&& _0xb6ccx1b[_0x6aca[53]]=== _0x6aca[54]){createInterval(_0xb6ccx1b)}});Automation[_0x6aca[60]](function(_0xb6ccx1b,_0xb6ccx1c){console[_0x6aca[9]](_0x6aca[47],_0xb6ccx1b[_0x6aca[12]],_0x6aca[59]);if(activeMailAutomations[_0x6aca[50]+ _0xb6ccx1b[_0x6aca[12]]]){console[_0x6aca[9]](_0x6aca[57],_0xb6ccx1b[_0x6aca[12]]);clearInterval(activeMailAutomations[_0x6aca[50]+ _0xb6ccx1b[_0x6aca[12]]]);delete activeMailAutomations[_0x6aca[50]+ _0xb6ccx1b[_0x6aca[12]]]}});return Automation[_0x6aca[30]](_0x6aca[29])[_0x6aca[27]]({where:{status:true,channel:_0x6aca[54]},attributes:[_0x6aca[12],_0x6aca[49]]})[_0x6aca[18]](function(_0xb6ccx1d){_0xb6ccx1d[_0x6aca[16]](function(_0xb6ccxf){createInterval(_0xb6ccxf)})})[_0x6aca[11]](function(_0xb6ccxb){console[_0x6aca[9]](_0x6aca[61],_0xb6ccxb)})}
\ No newline at end of file