Built motion from commit 2e74e5e.|0.0.138
[motion.git] / server / config / automations / mail.js
index 4e15593..6c85c0d 100644 (file)
@@ -1 +1 @@
-var _0x8e5d=["\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"];_0x8e5d[0];var _=require(_0x8e5d[1]);var config=require(_0x8e5d[2]);var moment=require(_0x8e5d[3]);var sequelize=require(_0x8e5d[5])[_0x8e5d[4]];var Automation=require(_0x8e5d[5])[_0x8e5d[6]];var MailRoom=require(_0x8e5d[5])[_0x8e5d[7]];var Settings=require(_0x8e5d[5])[_0x8e5d[8]];var activeMailAutomations={};function executeAutomation(_0xd796xa){console[_0x8e5d[10]](_0x8e5d[9],_0xd796xa);var _0xd796xb;return Automation[_0x8e5d[30]](_0x8e5d[29])[_0x8e5d[28]](_0xd796xa)[_0x8e5d[19]](function(_0xd796x10){_0xd796xb= _0xd796x10;var _0xd796x11={where:{$and:[],$or:[]}};_0xd796x10[_0x8e5d[24]][_0x8e5d[17]](function(_0xd796x12){_0xd796x11[_0x8e5d[23]][_0x8e5d[22]][_0x8e5d[21]](getCondition(_0xd796x12[_0x8e5d[20]]))});_0xd796x10[_0x8e5d[26]][_0x8e5d[17]](function(_0xd796x12){_0xd796x11[_0x8e5d[23]][_0x8e5d[25]][_0x8e5d[21]](getCondition(_0xd796x12[_0x8e5d[20]]))});return MailRoom[_0x8e5d[27]](_0xd796x11)})[_0x8e5d[19]](function(_0xd796xd){_0xd796xd[_0x8e5d[17]](function(_0xd796xe){_0xd796xb[_0x8e5d[18]][_0x8e5d[17]](function(_0xd796xf){switch(_0xd796xf[_0x8e5d[16]]){case _0x8e5d[15]:setStatus(_0xd796xe[_0x8e5d[13]],_0xd796xf[_0x8e5d[14]]);break;default:}})})})[_0x8e5d[12]](function(_0xd796xc){console[_0x8e5d[10]](_0x8e5d[11],_0xd796xc)})}function setStatus(_0xd796x14,_0xd796x15){return MailRoom[_0x8e5d[32]]({status:_0xd796x15},{where:{id:_0xd796x14}})[_0x8e5d[12]](function(_0xd796xc){console[_0x8e5d[10]](_0x8e5d[31],_0xd796xc)})}function getCondition(_0xd796x12){var _0xd796x17={};switch(_0xd796x12[_0x8e5d[33]]){case _0x8e5d[15]:switch(_0xd796x12[_0x8e5d[37]]){case _0x8e5d[35]:_0xd796x17[_0xd796x12[_0x8e5d[33]]]= _0xd796x12[_0x8e5d[34]];break;case _0x8e5d[36]:_0xd796x17[_0xd796x12[_0x8e5d[33]]]= {$ne:_0xd796x12[_0x8e5d[34]]};break;default:};break;case _0x8e5d[46]:var _0xd796x18=moment()[_0x8e5d[41]](parseInt(_0xd796x12[_0x8e5d[34]],10),_0x8e5d[40])[_0x8e5d[39]](_0x8e5d[38]);switch(_0xd796x12[_0x8e5d[37]]){case _0x8e5d[42]:_0xd796x17[_0xd796x12[_0x8e5d[33]]]= {lt:_0xd796x18};break;case _0x8e5d[43]:_0xd796x17[_0xd796x12[_0x8e5d[33]]]= {$lte:_0xd796x18};break;case _0x8e5d[44]:_0xd796x17[_0xd796x12[_0x8e5d[33]]]= {$gt:_0xd796x18};break;case _0x8e5d[45]:_0xd796x17[_0xd796x12[_0x8e5d[33]]]= {$gte:_0xd796x18};break;default:};break;default:};return _0xd796x17}function createInterval(_0xd796x10){console[_0x8e5d[10]](_0x8e5d[47],_0xd796x10[_0x8e5d[13]],_0x8e5d[48],_0xd796x10[_0x8e5d[49]]* 60* 1000);activeMailAutomations[_0x8e5d[50]+ _0xd796x10[_0x8e5d[13]]]= setInterval(function(){executeAutomation(_0xd796x10[_0x8e5d[13]])},_0xd796x10[_0x8e5d[49]]* 60* 1000)}module[_0x8e5d[51]]= function(){Automation[_0x8e5d[55]](function(_0xd796x1a,_0xd796x1b){console[_0x8e5d[10]](_0x8e5d[47],_0xd796x1a[_0x8e5d[13]],_0x8e5d[52],_0xd796x1a[_0x8e5d[15]]);if(_0xd796x1a[_0x8e5d[15]]&& _0xd796x1a[_0x8e5d[53]]=== _0x8e5d[54]){createInterval(_0xd796x1a)}});Automation[_0x8e5d[58]](function(_0xd796x1a,_0xd796x1b){console[_0x8e5d[10]](_0x8e5d[47],_0xd796x1a[_0x8e5d[13]],_0x8e5d[56],_0xd796x1a[_0x8e5d[15]]);if(activeMailAutomations[_0x8e5d[50]+ _0xd796x1a[_0x8e5d[13]]]){console[_0x8e5d[10]](_0x8e5d[57],_0xd796x1a[_0x8e5d[13]]);clearInterval(activeMailAutomations[_0x8e5d[50]+ _0xd796x1a[_0x8e5d[13]]]);delete activeMailAutomations[_0x8e5d[50]+ _0xd796x1a[_0x8e5d[13]]]};if(_0xd796x1a[_0x8e5d[15]]&& _0xd796x1a[_0x8e5d[53]]=== _0x8e5d[54]){createInterval(_0xd796x1a)}});Automation[_0x8e5d[60]](function(_0xd796x1a,_0xd796x1b){console[_0x8e5d[10]](_0x8e5d[47],_0xd796x1a[_0x8e5d[13]],_0x8e5d[59]);if(activeMailAutomations[_0x8e5d[50]+ _0xd796x1a[_0x8e5d[13]]]){console[_0x8e5d[10]](_0x8e5d[57],_0xd796x1a[_0x8e5d[13]]);clearInterval(activeMailAutomations[_0x8e5d[50]+ _0xd796x1a[_0x8e5d[13]]]);delete activeMailAutomations[_0x8e5d[50]+ _0xd796x1a[_0x8e5d[13]]]}});return Automation[_0x8e5d[30]](_0x8e5d[29])[_0x8e5d[27]]({where:{status:true,channel:_0x8e5d[54]},attributes:[_0x8e5d[13],_0x8e5d[49]]})[_0x8e5d[19]](function(_0xd796x1c){_0xd796x1c[_0x8e5d[17]](function(_0xd796x10){createInterval(_0xd796x10)})})[_0x8e5d[12]](function(_0xd796xc){console[_0x8e5d[10]](_0x8e5d[61],_0xd796xc)})}
\ 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