Built motion from commit 76eb00b9e.|1.0.24
[motion.git] / server / config / chat.js
1 var _0xf806=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x43\x68\x61\x74\x57\x65\x62\x73\x69\x74\x65","\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x43\x68\x61\x74\x56\x69\x73\x69\x74\x6F\x72","\x43\x68\x61\x74\x52\x6F\x6F\x6D","\x2E\x2F\x63\x68\x61\x74","\x52\x65\x70\x6F\x72\x74\x43\x68\x61\x74","\x52\x65\x70\x6F\x72\x74\x43\x68\x61\x74\x53\x65\x73\x73\x69\x6F\x6E","\x4D\x61\x69\x6C\x4D\x65\x73\x73\x61\x67\x65","\x53\x6D\x73\x4D\x65\x73\x73\x61\x67\x65","\x53\x65\x74\x74\x69\x6E\x67","\x6C\x6F\x64\x61\x73\x68","\x70\x61\x74\x68","\x75\x74\x69\x6C","\x6D\x6F\x6D\x65\x6E\x74","\x63\x68\x69\x6C\x64\x5F\x70\x72\x6F\x63\x65\x73\x73","\x6B\x75\x65","\x2E\x2F\x65\x6E\x76\x69\x72\x6F\x6E\x6D\x65\x6E\x74","\x2E\x2F\x75\x74\x69\x6C","\x63\x68\x61\x74","\x2E\x2F\x6C\x6F\x67\x67\x65\x72\x2E\x6A\x73","\x63\x72\x65\x61\x74\x65\x51\x75\x65\x75\x65","\x65\x78\x69\x74","\x70\x69\x64","\x70\x72\x6F\x63\x65\x73\x73","\x64\x61\x74\x61","\x72\x65\x6D\x6F\x76\x65","\x6F\x6E","\x6D\x65\x73\x73\x61\x67\x65","\x4D\x61\x69\x6C\x52\x6F\x6F\x6D\x49\x64","\x6D\x73\x67","\x63\x72\x65\x61\x74\x65","\x63\x72\x65\x61\x74\x65\x4D\x61\x69\x6C","\x63\x72\x65\x61\x74\x65\x53\x6D\x73","\x74\x79\x70\x65","\x73\x65\x6E\x64","\x63\x72\x65\x61\x74\x65\x43\x68\x61\x74\x51\x75\x65\x75\x65\x53\x65\x73\x73\x69\x6F\x6E","\x72\x6F\x6F\x74","\x2F\x73\x65\x72\x76\x65\x72\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x66\x6F\x72\x6B\x65\x64\x5F\x72\x6F\x75\x74\x69\x6E\x67\x2F\x63\x68\x61\x74\x2F\x69\x6E\x64\x65\x78\x2E\x6A\x73","\x6A\x6F\x69\x6E","\x66\x6F\x72\x6B","\x6F\x62\x6A","\x70\x75\x73\x68","\x65\x78\x70\x6F\x72\x74\x73","\x43\x68\x61\x74\x20\x69\x6E\x69\x74\x69\x61\x6C\x69\x7A\x61\x74\x69\x6F\x6E\x20\x65\x72\x72\x6F\x72","\x73\x74\x61\x63\x6B","\x65\x72\x72\x6F\x72","\x63\x61\x74\x63\x68","\x43\x48\x41\x54\x20\x77\x65\x62\x73\x69\x74\x65\x20\x49\x6E\x69\x74\x69\x61\x6C\x69\x7A\x61\x74\x69\x6F\x6E","\x69\x6E\x66\x6F","\x67\x65\x74","\x63\x6F\x6E\x6E\x65\x63\x74\x69\x64","\x63\x68\x61\x6E\x67\x65\x64","\x45\x72\x72\x6F\x72\x20\x6F\x6E\x20\x6D\x61\x69\x6C\x20\x61\x63\x63\x65\x70\x74","\x72\x6F\x6F\x6D\x69\x64","\x66\x69\x6E\x64","\x73\x74\x6F\x70","\x6D\x65\x6D\x62\x65\x72\x6E\x61\x6D\x65","\x74\x68\x65\x6E","\x6D\x65\x6D\x62\x65\x72\x69\x64","\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","\x75\x6E\x69\x71\x75\x65\x69\x64","\x75\x70\x64\x61\x74\x65","\x72\x65\x6A\x65\x63\x74\x65\x64\x41\x74","\x72\x65\x6A\x65\x63\x74","\x61\x66\x74\x65\x72\x55\x70\x64\x61\x74\x65","\x77\x65\x62\x73\x69\x74\x65\x69\x64","\x61\x63\x63\x65\x70\x74","\x65\x78\x74\x65\x72\x6E\x61\x6C","\x73\x74\x61\x72\x74","\x25\x73\x2E\x25\x73","\x75\x6E\x69\x78","\x69\x64","\x43\x68\x61\x74\x57\x65\x62\x73\x69\x74\x65\x49\x64","\x77\x65\x62\x73\x69\x74\x65","\x76\x69\x73\x69\x74\x6F\x72\x69\x64","\x70\x61\x72\x61\x6D\x31","\x76\x69\x73\x69\x74\x6F\x72\x6E\x61\x6D\x65","\x66\x75\x6C\x6C\x6E\x61\x6D\x65","\x76\x69\x73\x69\x74\x6F\x72\x65\x6D\x61\x69\x6C","\x65\x6D\x61\x69\x6C","\x73\x61\x76\x65","\x72\x65\x6D\x6F\x76\x65\x4F\x6E\x43\x6F\x6D\x70\x6C\x65\x74\x65","\x4E\x65\x77\x20\x63\x68\x61\x74\x20\x66\x72\x6F\x6D\x3A\x20\x25\x73","\x61\x63\x63\x6F\x75\x6E\x74\x69\x64","\x61\x63\x63\x6F\x75\x6E\x74\x6E\x61\x6D\x65","\x6E\x61\x6D\x65","\x61\x63\x63\x6F\x75\x6E\x74\x61\x64\x64\x72\x65\x73\x73","\x61\x64\x64\x72\x65\x73\x73","\x77\x65\x62\x73\x69\x74\x65\x6E\x61\x6D\x65","\x77\x65\x62\x73\x69\x74\x65\x61\x64\x64\x72\x65\x73\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x73\x74\x61\x74\x75\x73","\x43\x4C\x4F\x53\x45\x44","\x63\x6C\x6F\x73\x65","\x61\x62\x61\x6E\x64\x6F\x6E","\x53\x54\x4F\x50\x20\x53\x43\x48\x45\x44\x55\x4C\x45\x52\x20\x49\x4E\x53\x54\x41\x4E\x43\x45\x2C\x20\x49\x4E\x54\x45\x52\x41\x43\x54\x49\x4F\x4E\x3A","\x64\x69\x61\x6C\x70\x6C\x61\x6E\x20\x65\x6E\x64\x65\x64","\x6C\x6F\x67","\x41\x42\x41\x4E\x44\x4F\x4E","\x63\x68\x61\x74\x52\x6F\x75\x74\x69\x6E\x67\x43\x61\x70\x61\x63\x69\x74\x79","\x66\x69\x6E\x64\x41\x6C\x6C","\x61\x63\x63\x65\x70\x74\x4D\x65\x74\x68\x6F\x64","\x61\x63\x63\x65\x70\x74\x55\x72\x6C","\x43\x68\x61\x74\x20\x77\x65\x62\x73\x69\x74\x65\x20\x3C","\x3E\x20\x65\x78\x65\x63\x75\x74\x69\x6E\x67\x20\x61\x63\x63\x65\x70\x74\x20\x77\x65\x62\x68\x6F\x6F\x6B","\x64\x65\x62\x75\x67","\x64\x61\x74\x61\x56\x61\x6C\x75\x65\x73","\x6C\x65\x6E\x67\x74\x68","\x61\x63\x74\x69\x6F\x6E\x73","\x65\x6E\x61\x62\x6C\x65\x64","\x65\x78\x65\x63\x41\x63\x74\x69\x6F\x6E","\x66\x6F\x72\x45\x61\x63\x68","\x72\x65\x6A\x65\x63\x74\x4D\x65\x74\x68\x6F\x64","\x72\x65\x6A\x65\x63\x74\x55\x72\x6C","\x3E\x20\x65\x78\x65\x63\x75\x74\x69\x6E\x67\x20\x72\x65\x6A\x65\x63\x74\x20\x77\x65\x62\x68\x6F\x6F\x6B","\x63\x6C\x6F\x73\x65\x4D\x65\x74\x68\x6F\x64","\x63\x6C\x6F\x73\x65\x55\x72\x6C","\x3E\x20\x65\x78\x65\x63\x75\x74\x69\x6E\x67\x20\x63\x6C\x6F\x73\x65\x20\x77\x65\x62\x68\x6F\x6F\x6B","\x57\x65\x62\x68\x6F\x6F\x6B\x20\x6E\x6F\x74\x20\x72\x65\x63\x6F\x67\x6E\x69\x7A\x65\x64","\x43\x68\x61\x74\x20\x77\x65\x62\x68\x6F\x6F\x6B\x20\x72\x65\x71\x75\x65\x73\x74\x20\x66\x61\x69\x6C\x65\x64\x21","\x72\x65\x71\x75\x65\x73\x74\x20\x73\x75\x63\x63\x65\x73\x73\x65\x66\x75\x6C\x21","\x73\x65\x6E\x64\x52\x65\x71\x75\x65\x73\x74","\x43\x68\x61\x74\x20\x77\x65\x62\x73\x69\x74\x65\x3A\x20","\x20\x43\x72\x65\x61\x74\x65","\x20\x55\x70\x64\x61\x74\x65","\x6D\x65\x72\x67\x65","\x75\x6E\x73\x68\x69\x66\x74","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79"];_0xf806[0];var ChatWebsite=require(_0xf806[2])[_0xf806[1]];var ChatVisitor=require(_0xf806[2])[_0xf806[3]];var ChatRoom=require(_0xf806[2])[_0xf806[4]];var Website=require(_0xf806[5]);var ReportChat=require(_0xf806[2])[_0xf806[6]];var ReportChatSession=require(_0xf806[2])[_0xf806[7]];var MailMessage=require(_0xf806[2])[_0xf806[8]];var SmsMessage=require(_0xf806[2])[_0xf806[9]];var Setting=require(_0xf806[2])[_0xf806[10]];var _=require(_0xf806[11]);var path=require(_0xf806[12]);var util=require(_0xf806[13]);var moment=require(_0xf806[14]);var cp=require(_0xf806[15]);var kue=require(_0xf806[16]);var config=require(_0xf806[17]);var Util=require(_0xf806[18]);var logger=require(_0xf806[20])(_0xf806[19]);var chatwebsites;var processes=[];var queue=kue[_0xf806[21]]();var ami;function handleChat(_0x2aa4x18,_0x2aa4x19){var _0x2aa4x1a=cp[_0xf806[40]](path[_0xf806[39]](config[_0xf806[37]],_0xf806[38]))[_0xf806[27]](_0xf806[28],function(_0x2aa4x1c){switch(_0x2aa4x1c[_0xf806[34]]){case _0xf806[32]:delete _0x2aa4x1c[_0xf806[30]][_0xf806[29]];return MailMessage[_0xf806[31]](_0x2aa4x1c[_0xf806[30]]);case _0xf806[33]:return SmsMessage[_0xf806[31]](_0x2aa4x1c[_0xf806[30]]);case _0xf806[36]:if(ami){ami[_0xf806[35]]({message:_0x2aa4x1c[_0xf806[34]],doc:_0x2aa4x1c[_0xf806[30]]})};break}})[_0xf806[27]](_0xf806[22],function(){var _0x2aa4x1b=_[_0xf806[26]](processes,{pid:_0x2aa4x18[_0xf806[25]][_0xf806[24]][_0xf806[23]]});_0x2aa4x19()});_0x2aa4x1a[_0xf806[35]](_0x2aa4x18[_0xf806[25]][_0xf806[41]]);_0x2aa4x18[_0xf806[25]][_0xf806[24]][_0xf806[24]]= _0x2aa4x1a;_0x2aa4x18[_0xf806[25]][_0xf806[24]][_0xf806[23]]= _0x2aa4x1a[_0xf806[23]];processes[_0xf806[42]](_0x2aa4x18[_0xf806[25]][_0xf806[24]])}module[_0xf806[43]]= function(_0x2aa4x1d){ami= _0x2aa4x1d;return Setting[_0xf806[55]]({where:{id:1},attributes:[_0xf806[73],_0xf806[102]],raw:true})[_0xf806[58]](function(_0x2aa4x29){if(_0x2aa4x29){queue[_0xf806[24]](_0xf806[19],_0x2aa4x29[_0xf806[102]],handleChat)};return ChatWebsite[_0xf806[103]]()})[_0xf806[58]](function(_0x2aa4x1f){logger[_0xf806[49]](_0xf806[48]);chatwebsites= _0x2aa4x1f;synch(chatwebsites);ReportChat[_0xf806[66]](function(_0x2aa4x20,_0x2aa4x21){var _0x2aa4x22=_0x2aa4x20[_0xf806[50]]({plain:true});if(_0x2aa4x20[_0xf806[52]](_0xf806[51])){return ReportChatSession[_0xf806[63]]({memberid:_0x2aa4x22[_0xf806[59]],membername:_0x2aa4x22[_0xf806[57]],leaveAt:moment()[_0xf806[61]](_0xf806[60])},{where:{uniqueid:_0x2aa4x22[_0xf806[62]],leaveAt:null},individualHooks:true})[_0xf806[58]](function(){var _0x2aa4x23=_[_0xf806[55]](processes,{roomid:_0x2aa4x22[_0xf806[54]],channel:_0xf806[19]});if(_0x2aa4x23){_0x2aa4x23[_0xf806[24]][_0xf806[35]]({type:_0xf806[56],membername:_0x2aa4x22[_0xf806[57]]})}})[_0xf806[47]](function(_0x2aa4x1e){logger[_0xf806[46]](_0xf806[53],_0x2aa4x1e)})}else {if(_0x2aa4x20[_0xf806[52]](_0xf806[64])){var _0x2aa4x23=_[_0xf806[55]](processes,{roomid:_0x2aa4x22[_0xf806[54]],channel:_0xf806[19]});if(_0x2aa4x23){_0x2aa4x23[_0xf806[24]][_0xf806[35]]({type:_0xf806[65],id:_0x2aa4x22[_0xf806[59]],membername:_0x2aa4x22[_0xf806[57]]})}}}});ReportChat[_0xf806[66]](function(_0x2aa4x20){var _0x2aa4x24=_[_0xf806[55]](chatwebsites,{id:_0x2aa4x20[_0xf806[67]]});if(_0x2aa4x24&& _0x2aa4x20[_0xf806[52]](_0xf806[51])){webhook(_0x2aa4x20,_0x2aa4x24,_0xf806[68])};if(_0x2aa4x24&& _0x2aa4x20[_0xf806[52]](_0xf806[64])){webhook(_0x2aa4x20,_0x2aa4x24,_0xf806[65])}});ChatRoom[_0xf806[93]](function(_0x2aa4x20){var _0x2aa4x25=_0x2aa4x20[_0xf806[50]]({plain:true});if(_0x2aa4x25[_0xf806[34]]=== _0xf806[69]){var _0x2aa4x26={type:_0xf806[70],param1:{channel:_0xf806[19],uniqueid:util[_0xf806[61]](_0xf806[71],moment()[_0xf806[72]](),_0x2aa4x25[_0xf806[73]]),roomid:_0x2aa4x25[_0xf806[73]],accountid:_0x2aa4x25[_0xf806[74]],accountname:_0x2aa4x25[_0xf806[75]]}};ChatWebsite[_0xf806[92]](_0x2aa4x25.ChatWebsiteId,{raw:true,attributes:[_0xf806[73],_0xf806[87],_0xf806[89]]})[_0xf806[58]](function(_0x2aa4x28){_0x2aa4x26[_0xf806[77]][_0xf806[85]]= _0x2aa4x28[_0xf806[73]];_0x2aa4x26[_0xf806[77]][_0xf806[86]]= _0x2aa4x28[_0xf806[87]];_0x2aa4x26[_0xf806[77]][_0xf806[88]]= _0x2aa4x28[_0xf806[89]];_0x2aa4x26[_0xf806[77]][_0xf806[67]]= _0x2aa4x28[_0xf806[73]];_0x2aa4x26[_0xf806[77]][_0xf806[90]]= _0x2aa4x28[_0xf806[87]];_0x2aa4x26[_0xf806[77]][_0xf806[91]]= _0x2aa4x28[_0xf806[89]];return ChatVisitor[_0xf806[92]](_0x2aa4x25.ChatVisitorId,{raw:true,attributes:[_0xf806[73],_0xf806[79],_0xf806[81]]})})[_0xf806[58]](function(_0x2aa4x27){_0x2aa4x26[_0xf806[77]][_0xf806[76]]= _0x2aa4x27[_0xf806[73]];_0x2aa4x26[_0xf806[77]][_0xf806[78]]= _0x2aa4x27[_0xf806[79]];_0x2aa4x26[_0xf806[77]][_0xf806[80]]= _0x2aa4x27[_0xf806[81]];return queue[_0xf806[31]](_0xf806[19],{title:util[_0xf806[61]](_0xf806[84],_0x2aa4x27[_0xf806[81]]),process:{id:_0x2aa4x25[_0xf806[73]],channel:_0xf806[19],roomid:_0x2aa4x25[_0xf806[73]]},obj:_0x2aa4x26})[_0xf806[83]](true)[_0xf806[82]]()})[_0xf806[47]](function(_0x2aa4x1e){console[_0xf806[46]](_0x2aa4x1e)})}});ChatRoom[_0xf806[66]](function(_0x2aa4x20){var _0x2aa4x24=_[_0xf806[55]](chatwebsites,{id:_0x2aa4x20[_0xf806[74]]});if(_0x2aa4x24&& _0x2aa4x20[_0xf806[52]](_0xf806[94])&& _0x2aa4x20[_0xf806[94]]=== _0xf806[95]){webhook(_0x2aa4x20,_0x2aa4x24,_0xf806[96])}});ReportChatSession[_0xf806[66]](function(_0x2aa4x20,_0x2aa4x21){if(_0x2aa4x20[_0xf806[52]](_0xf806[97])&& _0x2aa4x20[_0xf806[97]]){console[_0xf806[49]](util[_0xf806[61]](_0xf806[98],_0x2aa4x20[_0xf806[54]]));var _0x2aa4x1b=_[_0xf806[55]](processes,{channel:_0xf806[19],roomid:_0x2aa4x20[_0xf806[54]]});if(_0x2aa4x1b){_0x2aa4x1b[_0xf806[24]][_0xf806[35]]({type:_0xf806[97]})};return ChatRoom[_0xf806[63]]({status:_0xf806[101]},{where:{id:_0x2aa4x20[_0xf806[54]]},individualHooks:true})[_0xf806[58]](function(){console[_0xf806[100]](_0xf806[99])})[_0xf806[47]](function(_0x2aa4x1e){console[_0xf806[46]]()})}})})[_0xf806[47]](function(_0x2aa4x1e){logger[_0xf806[46]](_0xf806[44],_0x2aa4x1e[_0xf806[45]])})};function webhook(_0x2aa4x20,_0x2aa4x24,_0x2aa4x2b){var _0x2aa4x2c=_0x2aa4x24;switch(_0x2aa4x2b){case _0xf806[68]:if(_0x2aa4x2c[_0xf806[104]]&& _0x2aa4x2c[_0xf806[105]]){logger[_0xf806[108]](_0xf806[106]+ _0x2aa4x2c[_0xf806[87]]+ _0xf806[107]);execRequest(_0x2aa4x20[_0xf806[109]],_0x2aa4x2c[_0xf806[104]],_0x2aa4x2c[_0xf806[105]])};if(_0x2aa4x2c[_0xf806[111]][_0xf806[110]]){_[_0xf806[114]](_0x2aa4x2c[_0xf806[111]],function(_0x2aa4x2d){if(_0x2aa4x2d[_0xf806[112]]){Util[_0xf806[113]](_0x2aa4x2d,_0x2aa4x20)}})};break;case _0xf806[65]:if(_0x2aa4x2c[_0xf806[115]]&& _0x2aa4x2c[_0xf806[116]]){logger[_0xf806[108]](_0xf806[106]+ _0x2aa4x2c[_0xf806[87]]+ _0xf806[117]);execRequest(_0x2aa4x20[_0xf806[109]],_0x2aa4x2c[_0xf806[115]],_0x2aa4x2c[_0xf806[116]])};break;case _0xf806[96]:if(_0x2aa4x2c[_0xf806[118]]&& _0x2aa4x2c[_0xf806[119]]){logger[_0xf806[108]](_0xf806[106]+ _0x2aa4x2c[_0xf806[87]]+ _0xf806[120]);execRequest(_0x2aa4x20[_0xf806[109]],_0x2aa4x2c[_0xf806[118]],_0x2aa4x2c[_0xf806[119]])};break;default:logger[_0xf806[46]](_0xf806[121])}}function execRequest(_0x2aa4x20,_0x2aa4x2f,_0x2aa4x30){Util[_0xf806[124]](_0x2aa4x20,_0x2aa4x2f,_0x2aa4x30)[_0xf806[58]](function(_0x2aa4x31){logger[_0xf806[108]](_0xf806[123])})[_0xf806[47]](function(_0x2aa4x1e){logger[_0xf806[46]](_0xf806[122],_0x2aa4x1e[_0xf806[45]])})}function synch(chatwebsites){ChatWebsite[_0xf806[93]](function(_0x2aa4x20){logger[_0xf806[108]](_0xf806[125]+ _0x2aa4x20[_0xf806[87]]+ _0xf806[126]);chatwebsites[_0xf806[42]](_0x2aa4x20)});ChatWebsite[_0xf806[66]](function(_0x2aa4x20){var _0x2aa4x33=_[_0xf806[55]](chatwebsites,{id:_0x2aa4x20[_0xf806[73]]});if(_0x2aa4x33){logger[_0xf806[108]](_0xf806[125]+ _0x2aa4x33[_0xf806[87]]+ _0xf806[127]);_[_0xf806[128]](_0x2aa4x33,_0x2aa4x20)}else {chatwebsites[_0xf806[129]](_0x2aa4x20)}});ChatWebsite[_0xf806[130]](function(_0x2aa4x20){_[_0xf806[26]](chatwebsites,{id:_0x2aa4x20[_0xf806[73]]})})}