Built motion from commit 5781103.|1.0.7
[motion.git] / server / config / automations / mail.js
index 353f695..4bd3e41 100644 (file)
@@ -1 +1 @@
-var _0x84a5=["\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"];_0x84a5[0];var _=require(_0x84a5[1]);var config=require(_0x84a5[2]);var moment=require(_0x84a5[3]);var sequelize=require(_0x84a5[5])[_0x84a5[4]];var Automation=require(_0x84a5[5])[_0x84a5[6]];var MailRoom=require(_0x84a5[5])[_0x84a5[7]];var Settings=require(_0x84a5[5])[_0x84a5[8]];var activeMailAutomations={};function executeAutomation(_0x1e6axa){console[_0x84a5[10]](_0x84a5[9],_0x1e6axa);var _0x1e6axb;return Automation[_0x84a5[30]](_0x84a5[29])[_0x84a5[28]](_0x1e6axa)[_0x84a5[19]](function(_0x1e6ax10){_0x1e6axb=_0x1e6ax10;var _0x1e6ax11={where:{$and:[],$or:[]}};_0x1e6ax10[_0x84a5[24]][_0x84a5[17]](function(_0x1e6ax12){_0x1e6ax11[_0x84a5[23]][_0x84a5[22]][_0x84a5[21]](getCondition(_0x1e6ax12[_0x84a5[20]]))});_0x1e6ax10[_0x84a5[26]][_0x84a5[17]](function(_0x1e6ax12){_0x1e6ax11[_0x84a5[23]][_0x84a5[25]][_0x84a5[21]](getCondition(_0x1e6ax12[_0x84a5[20]]))});return MailRoom[_0x84a5[27]](_0x1e6ax11)})[_0x84a5[19]](function(_0x1e6axd){_0x1e6axd[_0x84a5[17]](function(_0x1e6axe){_0x1e6axb[_0x84a5[18]][_0x84a5[17]](function(_0x1e6axf){switch(_0x1e6axf[_0x84a5[16]]){case _0x84a5[15]:setStatus(_0x1e6axe[_0x84a5[13]],_0x1e6axf[_0x84a5[14]]);break;default:}})})})[_0x84a5[12]](function(_0x1e6axc){console[_0x84a5[10]](_0x84a5[11],_0x1e6axc)})}function setStatus(_0x1e6ax14,_0x1e6ax15){return MailRoom[_0x84a5[32]]({status:_0x1e6ax15},{where:{id:_0x1e6ax14}})[_0x84a5[12]](function(_0x1e6axc){console[_0x84a5[10]](_0x84a5[31],_0x1e6axc)})}function getCondition(_0x1e6ax12){var _0x1e6ax17={};switch(_0x1e6ax12[_0x84a5[33]]){case _0x84a5[15]:switch(_0x1e6ax12[_0x84a5[37]]){case _0x84a5[35]:_0x1e6ax17[_0x1e6ax12[_0x84a5[33]]]=_0x1e6ax12[_0x84a5[34]];break;case _0x84a5[36]:_0x1e6ax17[_0x1e6ax12[_0x84a5[33]]]={$ne:_0x1e6ax12[_0x84a5[34]]};break;default:};break;case _0x84a5[46]:var _0x1e6ax18=moment()[_0x84a5[41]](parseInt(_0x1e6ax12[_0x84a5[34]],10),_0x84a5[40])[_0x84a5[39]](_0x84a5[38]);switch(_0x1e6ax12[_0x84a5[37]]){case _0x84a5[42]:_0x1e6ax17[_0x1e6ax12[_0x84a5[33]]]={lt:_0x1e6ax18};break;case _0x84a5[43]:_0x1e6ax17[_0x1e6ax12[_0x84a5[33]]]={$lte:_0x1e6ax18};break;case _0x84a5[44]:_0x1e6ax17[_0x1e6ax12[_0x84a5[33]]]={$gt:_0x1e6ax18};break;case _0x84a5[45]:_0x1e6ax17[_0x1e6ax12[_0x84a5[33]]]={$gte:_0x1e6ax18};break;default:};break;default:};return _0x1e6ax17}function createInterval(_0x1e6ax10){console[_0x84a5[10]](_0x84a5[47],_0x1e6ax10[_0x84a5[13]],_0x84a5[48],_0x1e6ax10[_0x84a5[49]]*60*1000);activeMailAutomations[_0x84a5[50]+_0x1e6ax10[_0x84a5[13]]]=setInterval(function(){executeAutomation(_0x1e6ax10[_0x84a5[13]])},_0x1e6ax10[_0x84a5[49]]*60*1000)}module[_0x84a5[51]]=function(){Automation[_0x84a5[55]](function(_0x1e6ax1a,_0x1e6ax1b){console[_0x84a5[10]](_0x84a5[47],_0x1e6ax1a[_0x84a5[13]],_0x84a5[52],_0x1e6ax1a[_0x84a5[15]]);if(_0x1e6ax1a[_0x84a5[15]]&&_0x1e6ax1a[_0x84a5[53]]===_0x84a5[54]){createInterval(_0x1e6ax1a)}});Automation[_0x84a5[58]](function(_0x1e6ax1a,_0x1e6ax1b){console[_0x84a5[10]](_0x84a5[47],_0x1e6ax1a[_0x84a5[13]],_0x84a5[56],_0x1e6ax1a[_0x84a5[15]]);if(activeMailAutomations[_0x84a5[50]+_0x1e6ax1a[_0x84a5[13]]]){console[_0x84a5[10]](_0x84a5[57],_0x1e6ax1a[_0x84a5[13]]);clearInterval(activeMailAutomations[_0x84a5[50]+_0x1e6ax1a[_0x84a5[13]]]);delete activeMailAutomations[_0x84a5[50]+_0x1e6ax1a[_0x84a5[13]]]};if(_0x1e6ax1a[_0x84a5[15]]&&_0x1e6ax1a[_0x84a5[53]]===_0x84a5[54]){createInterval(_0x1e6ax1a)}});Automation[_0x84a5[60]](function(_0x1e6ax1a,_0x1e6ax1b){console[_0x84a5[10]](_0x84a5[47],_0x1e6ax1a[_0x84a5[13]],_0x84a5[59]);if(activeMailAutomations[_0x84a5[50]+_0x1e6ax1a[_0x84a5[13]]]){console[_0x84a5[10]](_0x84a5[57],_0x1e6ax1a[_0x84a5[13]]);clearInterval(activeMailAutomations[_0x84a5[50]+_0x1e6ax1a[_0x84a5[13]]]);delete activeMailAutomations[_0x84a5[50]+_0x1e6ax1a[_0x84a5[13]]]}});return Automation[_0x84a5[30]](_0x84a5[29])[_0x84a5[27]]({where:{status:true,channel:_0x84a5[54]},attributes:[_0x84a5[13],_0x84a5[49]]})[_0x84a5[19]](function(_0x1e6ax1c){_0x1e6ax1c[_0x84a5[17]](function(_0x1e6ax10){createInterval(_0x1e6ax10)})})[_0x84a5[12]](function(_0x1e6axc){console[_0x84a5[10]](_0x84a5[61],_0x1e6axc)})}
\ No newline at end of file
+var _0xa24f=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x6D\x6F\x6D\x65\x6E\x74","\x41\x75\x74\x6F\x6D\x61\x74\x69\x6F\x6E","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x4D\x61\x69\x6C\x52\x6F\x6F\x6D","\x5B\x41\x75\x74\x6F\x6D\x61\x74\x69\x6F\x6E\x5D\x20\x45\x78\x65\x63\x75\x74\x69\x6E\x67\x20\x4D\x61\x69\x6C","\x6C\x6F\x67","\x5B\x41\x75\x74\x6F\x6D\x61\x74\x69\x6F\x6E\x5D\x20\x45\x72\x72\x6F\x72\x20\x69\x6E\x20\x4D\x61\x69\x6C\x20\x65\x78\x65\x63","\x65\x72\x72\x6F\x72","\x5B\x41\x75\x74\x6F\x6D\x61\x74\x69\x6F\x6E\x5D\x20\x4D\x65\x73\x73\x61\x67\x65\x3A","\x6D\x65\x73\x73\x61\x67\x65","\x5B\x41\x75\x74\x6F\x6D\x61\x74\x69\x6F\x6E\x5D\x20\x53\x74\x61\x63\x6B\x3A","\x73\x74\x61\x63\x6B","\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","\x5B\x41\x75\x74\x6F\x6D\x61\x74\x69\x6F\x6E\x5D\x20\x45\x72\x72\x6F\x72\x20\x69\x6E\x20\x4D\x61\x69\x6C\x20\x73\x65\x74\x53\x74\x61\x74\x75\x73","\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","\x5B\x41\x75\x74\x6F\x6D\x61\x74\x69\x6F\x6E\x5D\x20\x4D\x61\x69\x6C","\x73\x65\x74\x20\x77\x69\x74\x68\x20\x74\x69\x6D\x65\x6F\x75\x74","\x74\x69\x6D\x65\x6F\x75\x74","\x69\x6E\x74\x65\x72\x76\x61\x6C","\x65\x78\x70\x6F\x72\x74\x73","\x5B\x41\x75\x74\x6F\x6D\x61\x74\x69\x6F\x6E\x5D\x20\x4D\x61\x69\x6C\x20\x73\x65\x72\x76\x69\x63\x65\x20\x73\x74\x61\x72\x74\x65\x64","\x63\x68\x61\x6E\x6E\x65\x6C","\x6D\x61\x69\x6C","\x63\x72\x65\x61\x74\x65\x64\x2C\x20\x74\x68\x65\x20\x73\x74\x61\x74\x75\x73\x20\x69\x73","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x75\x70\x64\x61\x74\x65\x64\x2C\x20\x74\x68\x65\x20\x73\x74\x61\x74\x75\x73\x20\x69\x73","\x5B\x41\x75\x74\x6F\x6D\x61\x74\x69\x6F\x6E\x5D\x20\x4D\x61\x69\x6C\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\x73\x74\x72\x6F\x79","\x5B\x41\x75\x74\x6F\x6D\x61\x74\x69\x6F\x6E\x5D\x20\x45\x72\x72\x6F\x72\x20\x69\x6E\x20\x4D\x61\x69\x6C\x20\x69\x6E\x69\x74","\x5B\x41\x75\x74\x6F\x6D\x61\x74\x69\x6F\x6E\x5D\x20\x4D\x61\x69\x6C\x20\x61\x72\x65"];_0xa24f[0];var _=require(_0xa24f[1]);var moment=require(_0xa24f[2]);var Automation=require(_0xa24f[4])[_0xa24f[3]];var MailRoom=require(_0xa24f[4])[_0xa24f[5]];var activeMailAutomations={};function executeAutomation(_0x541dx7){console[_0xa24f[7]](_0xa24f[6],_0x541dx7);var _0x541dx8;return Automation[_0xa24f[33]](_0xa24f[32])[_0xa24f[31]](_0x541dx7)[_0xa24f[21]](function(_0x541dxd){_0x541dx8= _0x541dxd;var _0x541dxe=[];var _0x541dxf=[];var _0x541dx10={where:{}};_0x541dxd[_0xa24f[24]][_0xa24f[19]](function(_0x541dx11){_0x541dxf[_0xa24f[23]](getCondition(_0x541dx11[_0xa24f[22]]))});_0x541dxd[_0xa24f[25]][_0xa24f[19]](function(_0x541dx11){_0x541dxe[_0xa24f[23]](getCondition(_0x541dx11[_0xa24f[22]]))});if(_0x541dxf[_0xa24f[26]]){_0x541dx10[_0xa24f[28]][_0xa24f[27]]= _0x541dxf};if(_0x541dxe[_0xa24f[26]]){_0x541dx10[_0xa24f[28]][_0xa24f[29]]= _0x541dxe};return MailRoom[_0xa24f[30]](_0x541dx10)})[_0xa24f[21]](function(_0x541dxa){_0x541dxa[_0xa24f[19]](function(_0x541dxb){_0x541dx8[_0xa24f[20]][_0xa24f[19]](function(_0x541dxc){switch(_0x541dxc[_0xa24f[18]]){case _0xa24f[17]:setStatus(_0x541dxb[_0xa24f[15]],_0x541dxc[_0xa24f[16]]);break;default:}})})})[_0xa24f[14]](function(_0x541dx9){console[_0xa24f[9]](_0xa24f[8]);console[_0xa24f[9]](_0xa24f[10],_0x541dx9[_0xa24f[11]]);console[_0xa24f[9]](_0xa24f[12],_0x541dx9[_0xa24f[13]])})}function setStatus(_0x541dx13,_0x541dx14){return MailRoom[_0xa24f[35]]({status:_0x541dx14},{where:{id:_0x541dx13}})[_0xa24f[14]](function(_0x541dx9){console[_0xa24f[9]](_0xa24f[34]);console[_0xa24f[9]](_0xa24f[10],_0x541dx9[_0xa24f[11]]);console[_0xa24f[9]](_0xa24f[12],_0x541dx9[_0xa24f[13]])})}function getCondition(_0x541dx11){var _0x541dx16={};switch(_0x541dx11[_0xa24f[36]]){case _0xa24f[17]:switch(_0x541dx11[_0xa24f[40]]){case _0xa24f[38]:_0x541dx16[_0x541dx11[_0xa24f[36]]]= _0x541dx11[_0xa24f[37]];break;case _0xa24f[39]:_0x541dx16[_0x541dx11[_0xa24f[36]]]= {$ne:_0x541dx11[_0xa24f[37]]};break;default:};break;case _0xa24f[49]:var _0x541dx17=moment()[_0xa24f[44]](parseInt(_0x541dx11[_0xa24f[37]],10),_0xa24f[43])[_0xa24f[42]](_0xa24f[41]);switch(_0x541dx11[_0xa24f[40]]){case _0xa24f[45]:_0x541dx16[_0x541dx11[_0xa24f[36]]]= {lt:_0x541dx17};break;case _0xa24f[46]:_0x541dx16[_0x541dx11[_0xa24f[36]]]= {$lte:_0x541dx17};break;case _0xa24f[47]:_0x541dx16[_0x541dx11[_0xa24f[36]]]= {$gt:_0x541dx17};break;case _0xa24f[48]:_0x541dx16[_0x541dx11[_0xa24f[36]]]= {$gte:_0x541dx17};break;default:};break;default:};return _0x541dx16}function createInterval(_0x541dxd){console[_0xa24f[7]](_0xa24f[50],_0x541dxd[_0xa24f[15]],_0xa24f[51],_0x541dxd[_0xa24f[52]]* 60* 1000);activeMailAutomations[_0xa24f[53]+ _0x541dxd[_0xa24f[15]]]= setInterval(function(){executeAutomation(_0x541dxd[_0xa24f[15]])},_0x541dxd[_0xa24f[52]]* 60* 1000)}module[_0xa24f[54]]= function(){console[_0xa24f[7]](_0xa24f[55]);Automation[_0xa24f[59]](function(_0x541dx19,_0x541dx1a){if(_0x541dx19[_0xa24f[56]]=== _0xa24f[57]){console[_0xa24f[7]](_0xa24f[50],_0x541dx19[_0xa24f[15]],_0xa24f[58],_0x541dx19[_0xa24f[17]]);if(_0x541dx19[_0xa24f[17]]){createInterval(_0x541dx19)}}});Automation[_0xa24f[62]](function(_0x541dx19,_0x541dx1a){if(_0x541dx19[_0xa24f[56]]=== _0xa24f[57]){console[_0xa24f[7]](_0xa24f[50],_0x541dx19[_0xa24f[15]],_0xa24f[60],_0x541dx19[_0xa24f[17]]);if(activeMailAutomations[_0xa24f[53]+ _0x541dx19[_0xa24f[15]]]){console[_0xa24f[7]](_0xa24f[61],_0x541dx19[_0xa24f[15]]);clearInterval(activeMailAutomations[_0xa24f[53]+ _0x541dx19[_0xa24f[15]]]);delete activeMailAutomations[_0xa24f[53]+ _0x541dx19[_0xa24f[15]]]};if(_0x541dx19[_0xa24f[17]]){createInterval(_0x541dx19)}}});Automation[_0xa24f[64]](function(_0x541dx19,_0x541dx1a){if(_0x541dx19[_0xa24f[56]]=== _0xa24f[57]){console[_0xa24f[7]](_0xa24f[50],_0x541dx19[_0xa24f[15]],_0xa24f[63]);if(activeMailAutomations[_0xa24f[53]+ _0x541dx19[_0xa24f[15]]]){console[_0xa24f[7]](_0xa24f[61],_0x541dx19[_0xa24f[15]]);clearInterval(activeMailAutomations[_0xa24f[53]+ _0x541dx19[_0xa24f[15]]]);delete activeMailAutomations[_0xa24f[53]+ _0x541dx19[_0xa24f[15]]]}}});return Automation[_0xa24f[33]](_0xa24f[32])[_0xa24f[30]]({where:{status:true,channel:_0xa24f[57]},attributes:[_0xa24f[15],_0xa24f[52]]})[_0xa24f[21]](function(_0x541dx1b){console[_0xa24f[7]](_0xa24f[66],_0x541dx1b[_0xa24f[26]]);_0x541dx1b[_0xa24f[19]](function(_0x541dxd){createInterval(_0x541dxd)})})[_0xa24f[14]](function(_0x541dx9){console[_0xa24f[9]](_0xa24f[65]);console[_0xa24f[9]](_0xa24f[10],_0x541dx9[_0xa24f[11]]);console[_0xa24f[9]](_0xa24f[12],_0x541dx9[_0xa24f[13]])})}
\ No newline at end of file