Built motion from commit 5b01f56.|0.0.106
[motion.git] / server / config / automations / mail.js
index e547943..3d68e67 100644 (file)
@@ -1 +1 @@
-var _0xbc78=["\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","\x64\x61\x74\x61\x56\x61\x6C\x75\x65\x73","\x70\x75\x73\x68","\x24\x61\x6E\x64","\x77\x68\x65\x72\x65","\x66\x6F\x72\x45\x61\x63\x68","\x41\x6C\x6C","\x24\x6F\x72","\x41\x6E\x79","\x6C\x6F\x67","\x63\x61\x74\x63\x68","\x69\x64","\x64\x61\x74\x61\x31","\x73\x74\x61\x74\x75\x73","\x61\x63\x74\x69\x6F\x6E","\x41\x63\x74\x69\x6F\x6E\x73","\x74\x68\x65\x6E","\x66\x69\x6E\x64\x41\x6C\x6C","\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","\x69\x6E\x74\x65\x72\x76\x61\x6C","\x74\x69\x6D\x65\x6F\x75\x74","\x65\x78\x70\x6F\x72\x74\x73","\x63\x68\x61\x6E\x6E\x65\x6C","\x6D\x61\x69\x6C","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x55\x70\x64\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x6C\x65\x74\x65","\x65\x72\x72\x6F\x72","\x61\x6C\x6C","\x73\x63\x6F\x70\x65"];_0xbc78[0];var _=require(_0xbc78[1]);var config=require(_0xbc78[2]);var moment=require(_0xbc78[3]);var sequelize=require(_0xbc78[5])[_0xbc78[4]];var Automation=require(_0xbc78[5])[_0xbc78[6]];var MailRoom=require(_0xbc78[5])[_0xbc78[7]];var Settings=require(_0xbc78[5])[_0xbc78[8]];var activeAutomations={};function executeAutomation(_0xf28cxa){var _0xf28cxb={where:{$and:[],$or:[]}};var _0xf28cxc={};_0xf28cxa[_0xbc78[14]][_0xbc78[13]](function(_0xf28cxd){_0xf28cxb[_0xbc78[12]][_0xbc78[11]][_0xbc78[10]](getCondition(_0xf28cxd[_0xbc78[9]]))});_0xf28cxa[_0xbc78[16]][_0xbc78[13]](function(_0xf28cxd){_0xf28cxb[_0xbc78[12]][_0xbc78[15]][_0xbc78[10]](getCondition(_0xf28cxd[_0xbc78[9]]))});return MailRoom[_0xbc78[25]](_0xf28cxb)[_0xbc78[24]](function(_0xf28cxf){_0xf28cxf[_0xbc78[13]](function(_0xf28cx10){_0xf28cxa[_0xbc78[23]][_0xbc78[13]](function(_0xf28cx11){switch(_0xf28cx11[_0xbc78[22]]){case _0xbc78[21]:setStatus(_0xf28cx10[_0xbc78[19]],_0xf28cx11[_0xbc78[20]]);break;default:}})})})[_0xbc78[18]](function(_0xf28cxe){console[_0xbc78[17]](_0xf28cxe)})}function setStatus(_0xf28cx13,_0xf28cx14){return MailRoom[_0xbc78[26]]({status:_0xf28cx14},{where:{id:_0xf28cx13}})[_0xbc78[18]](function(_0xf28cxe){console[_0xbc78[17]](_0xf28cxe)})}function getCondition(_0xf28cxd){var _0xf28cx16={};switch(_0xf28cxd[_0xbc78[27]]){case _0xbc78[21]:switch(_0xf28cxd[_0xbc78[31]]){case _0xbc78[29]:_0xf28cx16[_0xf28cxd[_0xbc78[27]]]=_0xf28cxd[_0xbc78[28]];break;case _0xbc78[30]:_0xf28cx16[_0xf28cxd[_0xbc78[27]]]={$ne:_0xf28cxd[_0xbc78[28]]};break;default:};break;case _0xbc78[40]:var _0xf28cx17=moment()[_0xbc78[35]](parseInt(_0xf28cxd[_0xbc78[28]],10),_0xbc78[34])[_0xbc78[33]](_0xbc78[32]);switch(_0xf28cxd[_0xbc78[31]]){case _0xbc78[36]:_0xf28cx16[_0xf28cxd[_0xbc78[27]]]={lt:_0xf28cx17};break;case _0xbc78[37]:_0xf28cx16[_0xf28cxd[_0xbc78[27]]]={$lte:_0xf28cx17};break;case _0xbc78[38]:_0xf28cx16[_0xf28cxd[_0xbc78[27]]]={$gt:_0xf28cx17};break;case _0xbc78[39]:_0xf28cx16[_0xf28cxd[_0xbc78[27]]]={$gte:_0xf28cx17};break;default:};break;default:};return _0xf28cx16}function createInterval(_0xf28cxa){activeAutomations[_0xbc78[41]+_0xf28cxa[_0xbc78[19]]]=setInterval(function(){executeAutomation(_0xf28cxa)},_0xf28cxa[_0xbc78[42]]*1000)}module[_0xbc78[43]]=function(){Automation[_0xbc78[46]](function(_0xf28cx19,_0xf28cx1a){if(_0xf28cx19[_0xbc78[21]]&&_0xf28cx19[_0xbc78[44]]===_0xbc78[45]){createInterval(_0xf28cx19)}});Automation[_0xbc78[47]](function(_0xf28cx19,_0xf28cx1a){if(activeAutomations[_0xbc78[41]+_0xf28cx19[_0xbc78[19]]]){clearInterval(activeAutomations[_0xbc78[41]+_0xf28cx19[_0xbc78[19]]])};if(_0xf28cx19[_0xbc78[21]]&&_0xf28cx19[_0xbc78[44]]===_0xbc78[45]){createInterval(_0xf28cx19)}});Automation[_0xbc78[48]](function(_0xf28cx19,_0xf28cx1a){if(activeAutomations[_0xbc78[41]+_0xf28cx19[_0xbc78[19]]]){clearInterval(activeAutomations[_0xbc78[41]+_0xf28cx19[_0xbc78[19]]])}});Automation[_0xbc78[51]](_0xbc78[50])[_0xbc78[25]]({where:{status:true,channel:_0xbc78[45]}})[_0xbc78[24]](function(_0xf28cx1b){_0xf28cx1b[_0xbc78[13]](function(_0xf28cxa){createInterval(_0xf28cxa)})})[_0xbc78[18]](function(_0xf28cxe){console[_0xbc78[49]](_0xf28cxe)})}
\ No newline at end of file
+var _0x7b31=["\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"];_0x7b31[0];var _=require(_0x7b31[1]);var config=require(_0x7b31[2]);var moment=require(_0x7b31[3]);var sequelize=require(_0x7b31[5])[_0x7b31[4]];var Automation=require(_0x7b31[5])[_0x7b31[6]];var MailRoom=require(_0x7b31[5])[_0x7b31[7]];var Settings=require(_0x7b31[5])[_0x7b31[8]];var activeMailAutomations={};function executeAutomation(_0x7bccxa){console[_0x7b31[10]](_0x7b31[9],_0x7bccxa);var _0x7bccxb;return Automation[_0x7b31[30]](_0x7b31[29])[_0x7b31[28]](_0x7bccxa)[_0x7b31[19]](function(_0x7bccx10){_0x7bccxb=_0x7bccx10;var _0x7bccx11={where:{$and:[],$or:[]}};_0x7bccx10[_0x7b31[24]][_0x7b31[17]](function(_0x7bccx12){_0x7bccx11[_0x7b31[23]][_0x7b31[22]][_0x7b31[21]](getCondition(_0x7bccx12[_0x7b31[20]]))});_0x7bccx10[_0x7b31[26]][_0x7b31[17]](function(_0x7bccx12){_0x7bccx11[_0x7b31[23]][_0x7b31[25]][_0x7b31[21]](getCondition(_0x7bccx12[_0x7b31[20]]))});return MailRoom[_0x7b31[27]](_0x7bccx11)})[_0x7b31[19]](function(_0x7bccxd){_0x7bccxd[_0x7b31[17]](function(_0x7bccxe){_0x7bccxb[_0x7b31[18]][_0x7b31[17]](function(_0x7bccxf){switch(_0x7bccxf[_0x7b31[16]]){case _0x7b31[15]:setStatus(_0x7bccxe[_0x7b31[13]],_0x7bccxf[_0x7b31[14]]);break;default:}})})})[_0x7b31[12]](function(_0x7bccxc){console[_0x7b31[10]](_0x7b31[11],_0x7bccxc)})}function setStatus(_0x7bccx14,_0x7bccx15){return MailRoom[_0x7b31[32]]({status:_0x7bccx15},{where:{id:_0x7bccx14}})[_0x7b31[12]](function(_0x7bccxc){console[_0x7b31[10]](_0x7b31[31],_0x7bccxc)})}function getCondition(_0x7bccx12){var _0x7bccx17={};switch(_0x7bccx12[_0x7b31[33]]){case _0x7b31[15]:switch(_0x7bccx12[_0x7b31[37]]){case _0x7b31[35]:_0x7bccx17[_0x7bccx12[_0x7b31[33]]]=_0x7bccx12[_0x7b31[34]];break;case _0x7b31[36]:_0x7bccx17[_0x7bccx12[_0x7b31[33]]]={$ne:_0x7bccx12[_0x7b31[34]]};break;default:};break;case _0x7b31[46]:var _0x7bccx18=moment()[_0x7b31[41]](parseInt(_0x7bccx12[_0x7b31[34]],10),_0x7b31[40])[_0x7b31[39]](_0x7b31[38]);switch(_0x7bccx12[_0x7b31[37]]){case _0x7b31[42]:_0x7bccx17[_0x7bccx12[_0x7b31[33]]]={lt:_0x7bccx18};break;case _0x7b31[43]:_0x7bccx17[_0x7bccx12[_0x7b31[33]]]={$lte:_0x7bccx18};break;case _0x7b31[44]:_0x7bccx17[_0x7bccx12[_0x7b31[33]]]={$gt:_0x7bccx18};break;case _0x7b31[45]:_0x7bccx17[_0x7bccx12[_0x7b31[33]]]={$gte:_0x7bccx18};break;default:};break;default:};return _0x7bccx17}function createInterval(_0x7bccx10){console[_0x7b31[10]](_0x7b31[47],_0x7bccx10[_0x7b31[13]],_0x7b31[48],_0x7bccx10[_0x7b31[49]]*60*1000);activeMailAutomations[_0x7b31[50]+_0x7bccx10[_0x7b31[13]]]=setInterval(function(){executeAutomation(_0x7bccx10[_0x7b31[13]])},_0x7bccx10[_0x7b31[49]]*60*1000)}module[_0x7b31[51]]=function(){Automation[_0x7b31[55]](function(_0x7bccx1a,_0x7bccx1b){console[_0x7b31[10]](_0x7b31[47],_0x7bccx1a[_0x7b31[13]],_0x7b31[52],_0x7bccx1a[_0x7b31[15]]);if(_0x7bccx1a[_0x7b31[15]]&&_0x7bccx1a[_0x7b31[53]]===_0x7b31[54]){createInterval(_0x7bccx1a)}});Automation[_0x7b31[58]](function(_0x7bccx1a,_0x7bccx1b){console[_0x7b31[10]](_0x7b31[47],_0x7bccx1a[_0x7b31[13]],_0x7b31[56],_0x7bccx1a[_0x7b31[15]]);if(activeMailAutomations[_0x7b31[50]+_0x7bccx1a[_0x7b31[13]]]){console[_0x7b31[10]](_0x7b31[57],_0x7bccx1a[_0x7b31[13]]);clearInterval(activeMailAutomations[_0x7b31[50]+_0x7bccx1a[_0x7b31[13]]]);delete activeMailAutomations[_0x7b31[50]+_0x7bccx1a[_0x7b31[13]]]};if(_0x7bccx1a[_0x7b31[15]]&&_0x7bccx1a[_0x7b31[53]]===_0x7b31[54]){createInterval(_0x7bccx1a)}});Automation[_0x7b31[60]](function(_0x7bccx1a,_0x7bccx1b){console[_0x7b31[10]](_0x7b31[47],_0x7bccx1a[_0x7b31[13]],_0x7b31[59]);if(activeMailAutomations[_0x7b31[50]+_0x7bccx1a[_0x7b31[13]]]){console[_0x7b31[10]](_0x7b31[57],_0x7bccx1a[_0x7b31[13]]);clearInterval(activeMailAutomations[_0x7b31[50]+_0x7bccx1a[_0x7b31[13]]]);delete activeMailAutomations[_0x7b31[50]+_0x7bccx1a[_0x7b31[13]]]}});return Automation[_0x7b31[30]](_0x7b31[29])[_0x7b31[27]]({where:{status:true,channel:_0x7b31[54]},attributes:[_0x7b31[13],_0x7b31[49]]})[_0x7b31[19]](function(_0x7bccx1c){_0x7bccx1c[_0x7b31[17]](function(_0x7bccx10){createInterval(_0x7bccx10)})})[_0x7b31[12]](function(_0x7bccxc){console[_0x7b31[10]](_0x7b31[61],_0x7bccxc)})}
\ No newline at end of file