Built motion from commit 822e0ac2e.|1.0.30
[motion.git] / server / config / chat.js
1 var _0xcff5=["\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"];_0xcff5[0];var ChatWebsite=require(_0xcff5[2])[_0xcff5[1]];var ChatVisitor=require(_0xcff5[2])[_0xcff5[3]];var ChatRoom=require(_0xcff5[2])[_0xcff5[4]];var Website=require(_0xcff5[5]);var ReportChat=require(_0xcff5[2])[_0xcff5[6]];var ReportChatSession=require(_0xcff5[2])[_0xcff5[7]];var MailMessage=require(_0xcff5[2])[_0xcff5[8]];var SmsMessage=require(_0xcff5[2])[_0xcff5[9]];var Setting=require(_0xcff5[2])[_0xcff5[10]];var _=require(_0xcff5[11]);var path=require(_0xcff5[12]);var util=require(_0xcff5[13]);var moment=require(_0xcff5[14]);var cp=require(_0xcff5[15]);var kue=require(_0xcff5[16]);var config=require(_0xcff5[17]);var Util=require(_0xcff5[18]);var logger=require(_0xcff5[20])(_0xcff5[19]);var chatwebsites;var processes=[];var queue=kue[_0xcff5[21]]();var ami;function handleChat(_0xcf0cx18,_0xcf0cx19){var _0xcf0cx1a=cp[_0xcff5[40]](path[_0xcff5[39]](config[_0xcff5[37]],_0xcff5[38]))[_0xcff5[27]](_0xcff5[28],function(_0xcf0cx1c){switch(_0xcf0cx1c[_0xcff5[34]]){case _0xcff5[32]:delete _0xcf0cx1c[_0xcff5[30]][_0xcff5[29]];return MailMessage[_0xcff5[31]](_0xcf0cx1c[_0xcff5[30]]);case _0xcff5[33]:return SmsMessage[_0xcff5[31]](_0xcf0cx1c[_0xcff5[30]]);case _0xcff5[36]:if(ami){ami[_0xcff5[35]]({message:_0xcf0cx1c[_0xcff5[34]],doc:_0xcf0cx1c[_0xcff5[30]]})};break}})[_0xcff5[27]](_0xcff5[22],function(){var _0xcf0cx1b=_[_0xcff5[26]](processes,{pid:_0xcf0cx18[_0xcff5[25]][_0xcff5[24]][_0xcff5[23]]});_0xcf0cx19()});_0xcf0cx1a[_0xcff5[35]](_0xcf0cx18[_0xcff5[25]][_0xcff5[41]]);_0xcf0cx18[_0xcff5[25]][_0xcff5[24]][_0xcff5[24]]= _0xcf0cx1a;_0xcf0cx18[_0xcff5[25]][_0xcff5[24]][_0xcff5[23]]= _0xcf0cx1a[_0xcff5[23]];processes[_0xcff5[42]](_0xcf0cx18[_0xcff5[25]][_0xcff5[24]])}module[_0xcff5[43]]= function(_0xcf0cx1d){ami= _0xcf0cx1d;return Setting[_0xcff5[55]]({where:{id:1},attributes:[_0xcff5[73],_0xcff5[102]],raw:true})[_0xcff5[58]](function(_0xcf0cx29){if(_0xcf0cx29){queue[_0xcff5[24]](_0xcff5[19],_0xcf0cx29[_0xcff5[102]],handleChat)};return ChatWebsite[_0xcff5[103]]()})[_0xcff5[58]](function(_0xcf0cx1f){logger[_0xcff5[49]](_0xcff5[48]);chatwebsites= _0xcf0cx1f;synch(chatwebsites);ReportChat[_0xcff5[66]](function(_0xcf0cx20,_0xcf0cx21){var _0xcf0cx22=_0xcf0cx20[_0xcff5[50]]({plain:true});if(_0xcf0cx20[_0xcff5[52]](_0xcff5[51])){return ReportChatSession[_0xcff5[63]]({memberid:_0xcf0cx22[_0xcff5[59]],membername:_0xcf0cx22[_0xcff5[57]],leaveAt:moment()[_0xcff5[61]](_0xcff5[60])},{where:{uniqueid:_0xcf0cx22[_0xcff5[62]],leaveAt:null},individualHooks:true})[_0xcff5[58]](function(){var _0xcf0cx23=_[_0xcff5[55]](processes,{roomid:_0xcf0cx22[_0xcff5[54]],channel:_0xcff5[19]});if(_0xcf0cx23){_0xcf0cx23[_0xcff5[24]][_0xcff5[35]]({type:_0xcff5[56],membername:_0xcf0cx22[_0xcff5[57]]})}})[_0xcff5[47]](function(_0xcf0cx1e){logger[_0xcff5[46]](_0xcff5[53],_0xcf0cx1e)})}else {if(_0xcf0cx20[_0xcff5[52]](_0xcff5[64])){var _0xcf0cx23=_[_0xcff5[55]](processes,{roomid:_0xcf0cx22[_0xcff5[54]],channel:_0xcff5[19]});if(_0xcf0cx23){_0xcf0cx23[_0xcff5[24]][_0xcff5[35]]({type:_0xcff5[65],id:_0xcf0cx22[_0xcff5[59]],membername:_0xcf0cx22[_0xcff5[57]]})}}}});ReportChat[_0xcff5[66]](function(_0xcf0cx20){var _0xcf0cx24=_[_0xcff5[55]](chatwebsites,{id:_0xcf0cx20[_0xcff5[67]]});if(_0xcf0cx24&& _0xcf0cx20[_0xcff5[52]](_0xcff5[51])){webhook(_0xcf0cx20,_0xcf0cx24,_0xcff5[68])};if(_0xcf0cx24&& _0xcf0cx20[_0xcff5[52]](_0xcff5[64])){webhook(_0xcf0cx20,_0xcf0cx24,_0xcff5[65])}});ChatRoom[_0xcff5[93]](function(_0xcf0cx20){var _0xcf0cx25=_0xcf0cx20[_0xcff5[50]]({plain:true});if(_0xcf0cx25[_0xcff5[34]]=== _0xcff5[69]){var _0xcf0cx26={type:_0xcff5[70],param1:{channel:_0xcff5[19],uniqueid:util[_0xcff5[61]](_0xcff5[71],moment()[_0xcff5[72]](),_0xcf0cx25[_0xcff5[73]]),roomid:_0xcf0cx25[_0xcff5[73]],accountid:_0xcf0cx25[_0xcff5[74]],accountname:_0xcf0cx25[_0xcff5[75]]}};ChatWebsite[_0xcff5[92]](_0xcf0cx25.ChatWebsiteId,{raw:true,attributes:[_0xcff5[73],_0xcff5[87],_0xcff5[89]]})[_0xcff5[58]](function(_0xcf0cx28){_0xcf0cx26[_0xcff5[77]][_0xcff5[85]]= _0xcf0cx28[_0xcff5[73]];_0xcf0cx26[_0xcff5[77]][_0xcff5[86]]= _0xcf0cx28[_0xcff5[87]];_0xcf0cx26[_0xcff5[77]][_0xcff5[88]]= _0xcf0cx28[_0xcff5[89]];_0xcf0cx26[_0xcff5[77]][_0xcff5[67]]= _0xcf0cx28[_0xcff5[73]];_0xcf0cx26[_0xcff5[77]][_0xcff5[90]]= _0xcf0cx28[_0xcff5[87]];_0xcf0cx26[_0xcff5[77]][_0xcff5[91]]= _0xcf0cx28[_0xcff5[89]];return ChatVisitor[_0xcff5[92]](_0xcf0cx25.ChatVisitorId,{raw:true,attributes:[_0xcff5[73],_0xcff5[79],_0xcff5[81]]})})[_0xcff5[58]](function(_0xcf0cx27){_0xcf0cx26[_0xcff5[77]][_0xcff5[76]]= _0xcf0cx27[_0xcff5[73]];_0xcf0cx26[_0xcff5[77]][_0xcff5[78]]= _0xcf0cx27[_0xcff5[79]];_0xcf0cx26[_0xcff5[77]][_0xcff5[80]]= _0xcf0cx27[_0xcff5[81]];return queue[_0xcff5[31]](_0xcff5[19],{title:util[_0xcff5[61]](_0xcff5[84],_0xcf0cx27[_0xcff5[81]]),process:{id:_0xcf0cx25[_0xcff5[73]],channel:_0xcff5[19],roomid:_0xcf0cx25[_0xcff5[73]]},obj:_0xcf0cx26})[_0xcff5[83]](true)[_0xcff5[82]]()})[_0xcff5[47]](function(_0xcf0cx1e){console[_0xcff5[46]](_0xcf0cx1e)})}});ChatRoom[_0xcff5[66]](function(_0xcf0cx20){var _0xcf0cx24=_[_0xcff5[55]](chatwebsites,{id:_0xcf0cx20[_0xcff5[74]]});if(_0xcf0cx24&& _0xcf0cx20[_0xcff5[52]](_0xcff5[94])&& _0xcf0cx20[_0xcff5[94]]=== _0xcff5[95]){webhook(_0xcf0cx20,_0xcf0cx24,_0xcff5[96])}});ReportChatSession[_0xcff5[66]](function(_0xcf0cx20,_0xcf0cx21){if(_0xcf0cx20[_0xcff5[52]](_0xcff5[97])&& _0xcf0cx20[_0xcff5[97]]){console[_0xcff5[49]](util[_0xcff5[61]](_0xcff5[98],_0xcf0cx20[_0xcff5[54]]));var _0xcf0cx1b=_[_0xcff5[55]](processes,{channel:_0xcff5[19],roomid:_0xcf0cx20[_0xcff5[54]]});if(_0xcf0cx1b){_0xcf0cx1b[_0xcff5[24]][_0xcff5[35]]({type:_0xcff5[97]})};return ChatRoom[_0xcff5[63]]({status:_0xcff5[101]},{where:{id:_0xcf0cx20[_0xcff5[54]]},individualHooks:true})[_0xcff5[58]](function(){console[_0xcff5[100]](_0xcff5[99])})[_0xcff5[47]](function(_0xcf0cx1e){console[_0xcff5[46]]()})}})})[_0xcff5[47]](function(_0xcf0cx1e){logger[_0xcff5[46]](_0xcff5[44],_0xcf0cx1e[_0xcff5[45]])})};function webhook(_0xcf0cx20,_0xcf0cx24,_0xcf0cx2b){var _0xcf0cx2c=_0xcf0cx24;switch(_0xcf0cx2b){case _0xcff5[68]:if(_0xcf0cx2c[_0xcff5[104]]&& _0xcf0cx2c[_0xcff5[105]]){logger[_0xcff5[108]](_0xcff5[106]+ _0xcf0cx2c[_0xcff5[87]]+ _0xcff5[107]);execRequest(_0xcf0cx20[_0xcff5[109]],_0xcf0cx2c[_0xcff5[104]],_0xcf0cx2c[_0xcff5[105]])};if(_0xcf0cx2c[_0xcff5[111]][_0xcff5[110]]){_[_0xcff5[114]](_0xcf0cx2c[_0xcff5[111]],function(_0xcf0cx2d){if(_0xcf0cx2d[_0xcff5[112]]){Util[_0xcff5[113]](_0xcf0cx2d,_0xcf0cx20)}})};break;case _0xcff5[65]:if(_0xcf0cx2c[_0xcff5[115]]&& _0xcf0cx2c[_0xcff5[116]]){logger[_0xcff5[108]](_0xcff5[106]+ _0xcf0cx2c[_0xcff5[87]]+ _0xcff5[117]);execRequest(_0xcf0cx20[_0xcff5[109]],_0xcf0cx2c[_0xcff5[115]],_0xcf0cx2c[_0xcff5[116]])};break;case _0xcff5[96]:if(_0xcf0cx2c[_0xcff5[118]]&& _0xcf0cx2c[_0xcff5[119]]){logger[_0xcff5[108]](_0xcff5[106]+ _0xcf0cx2c[_0xcff5[87]]+ _0xcff5[120]);execRequest(_0xcf0cx20[_0xcff5[109]],_0xcf0cx2c[_0xcff5[118]],_0xcf0cx2c[_0xcff5[119]])};break;default:logger[_0xcff5[46]](_0xcff5[121])}}function execRequest(_0xcf0cx20,_0xcf0cx2f,_0xcf0cx30){Util[_0xcff5[124]](_0xcf0cx20,_0xcf0cx2f,_0xcf0cx30)[_0xcff5[58]](function(_0xcf0cx31){logger[_0xcff5[108]](_0xcff5[123])})[_0xcff5[47]](function(_0xcf0cx1e){logger[_0xcff5[46]](_0xcff5[122],_0xcf0cx1e[_0xcff5[45]])})}function synch(chatwebsites){ChatWebsite[_0xcff5[93]](function(_0xcf0cx20){logger[_0xcff5[108]](_0xcff5[125]+ _0xcf0cx20[_0xcff5[87]]+ _0xcff5[126]);chatwebsites[_0xcff5[42]](_0xcf0cx20)});ChatWebsite[_0xcff5[66]](function(_0xcf0cx20){var _0xcf0cx33=_[_0xcff5[55]](chatwebsites,{id:_0xcf0cx20[_0xcff5[73]]});if(_0xcf0cx33){logger[_0xcff5[108]](_0xcff5[125]+ _0xcf0cx33[_0xcff5[87]]+ _0xcff5[127]);_[_0xcff5[128]](_0xcf0cx33,_0xcf0cx20)}else {chatwebsites[_0xcff5[129]](_0xcf0cx20)}});ChatWebsite[_0xcff5[130]](function(_0xcf0cx20){_[_0xcff5[26]](chatwebsites,{id:_0xcf0cx20[_0xcff5[73]]})})}