Built motion from commit 444aa05.|0.0.86
[motion.git] / server / config / routing / mail / session.js
1 var _0xdb82=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x6D\x6F\x6D\x65\x6E\x74","\x55\x73\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x4D\x61\x69\x6C\x52\x6F\x6F\x6D","\x4D\x61\x69\x6C\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E","\x52\x65\x70\x6F\x72\x74\x4D\x61\x69\x6C","\x52\x65\x70\x6F\x72\x74\x4D\x61\x69\x6C\x52\x6F\x6F\x6D","\x52\x65\x70\x6F\x72\x74\x4D\x61\x69\x6C\x53\x65\x73\x73\x69\x6F\x6E","\x4E\x65\x77\x20\x4D\x61\x69\x6C\x20\x73\x65\x73\x73\x69\x6F\x6E\x2E\x2E\x2E","\x6C\x6F\x67","\x65\x72\x72\x6F\x72","\x63\x61\x74\x63\x68","\x6D\x61\x69\x6C\x43\x61\x70\x61\x63\x69\x74\x79","\x6C\x65\x6E\x67\x74\x68","\x69\x64","\x72\x6F\x6F\x6D\x69\x64","\x73\x74\x61\x74\x75\x73","\x43\x4C\x4F\x53\x45\x44","\x66\x69\x6C\x74\x65\x72","\x6E\x61\x6D\x65","\x6D\x61\x70","\x74\x69\x6D\x65\x73\x6C\x6F\x74","\x61\x70\x70\x74\x69\x6D\x65\x6F\x75\x74","\x71\x75\x65\x75\x65\x74\x69\x6D\x65\x6F\x75\x74","\x63\x6C\x6F\x6E\x65\x44\x65\x65\x70","\x73\x68\x69\x66\x74","\x61\x76\x61\x69\x6C\x61\x62\x6C\x65","\x70\x75\x73\x68","\x72\x72\x6D\x65\x6D\x6F\x72\x79","\x64\x69\x66\x66\x65\x72\x65\x6E\x63\x65\x42\x79","\x62\x65\x65\x70\x61\x6C\x6C","\x73\x74\x72\x61\x74\x65\x67\x79","\x74\x68\x65\x6E","\x61\x67\x65\x6E\x74\x73","\x66\x69\x6E\x64\x41\x6C\x6C","\x72\x65\x6A\x65\x63\x74\x65\x64\x41\x74","\x63\x68\x61\x6E\x67\x65\x64","\x6D\x65\x6D\x62\x65\x72\x69\x64","\x6D\x65\x6D\x62\x65\x72\x6E\x61\x6D\x65","\x63\x6F\x6E\x6E\x65\x63\x74\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","\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E","\x71\x75\x65\x75\x65\x69\x64","\x71\x75\x65\x75\x65\x6E\x61\x6D\x65","\x61\x64\x64\x55\x73\x65\x72","\x66\x69\x6E\x64\x42\x79\x49\x64","\x61\x66\x74\x65\x72\x55\x70\x64\x61\x74\x65","\x73\x75\x62\x6A\x65\x63\x74","\x61\x63\x63\x6F\x75\x6E\x74\x69\x64","\x61\x63\x63\x6F\x75\x6E\x74\x6E\x61\x6D\x65","\x61\x63\x63\x6F\x75\x6E\x74\x61\x64\x64\x72\x65\x73\x73","\x6D\x65\x73\x73\x61\x67\x65\x69\x64","\x66\x6F\x72\x45\x61\x63\x68","\x62\x75\x6C\x6B\x43\x72\x65\x61\x74\x65","\x65\x78\x70\x6F\x72\x74\x73"];_0xdb82[0];var _=require(_0xdb82[1]);var moment=require(_0xdb82[2]);var Agent=require(_0xdb82[4])[_0xdb82[3]];var MailRoom=require(_0xdb82[4])[_0xdb82[5]];var MailApplication=require(_0xdb82[4])[_0xdb82[6]];var ReportMail=require(_0xdb82[4])[_0xdb82[7]];var ReportMailRoom=require(_0xdb82[4])[_0xdb82[8]];var ReportMailSession=require(_0xdb82[4])[_0xdb82[9]];function Session(_0xe602xa,_0xe602xb){console[_0xdb82[11]](_0xdb82[10]);var _0xe602xc=0;var _0xe602xd,_0xe602xe;var _0xe602xf=[];Agent[_0xdb82[36]]({where:{id:{$in:_[_0xdb82[22]](_0xe602xa[_0xdb82[35]],_0xdb82[16])},online:true,mailPause:false},include:[{model:MailRoom,attributes:[_0xdb82[16],_0xdb82[18]]}],attributes:[_0xdb82[16],_0xdb82[21],_0xdb82[14]]})[_0xdb82[34]](function(_0xe602x11){var _0xe602x12=_[_0xdb82[22]](_[_0xdb82[20]](_0xe602x11,function(_0xe602x13){if(_0xe602x13[_0xdb82[14]]===0){return true}else {return _0xe602x13[_0xdb82[14]]>_[_0xdb82[20]](_0xe602x13.MailRooms,function(_0xe602x14){return _0xe602x14[_0xdb82[16]]!==_0xe602xa[_0xdb82[17]]&&_0xe602x14[_0xdb82[18]]!==_0xdb82[19]})[_0xdb82[15]]}}),function(_0xe602x13){return {id:_0xe602x13[_0xdb82[16]],name:_0xe602x13[_0xdb82[21]]}});var _0xe602x15=[];var _0xe602x16;var _0xe602x13;_0xe602xa[_0xdb82[23]]=((_0xe602xa[_0xdb82[24]]-_0xe602xc)>_0xe602xa[_0xdb82[25]])?_0xe602xa[_0xdb82[25]]:(_0xe602xa[_0xdb82[24]]-_0xe602xc);switch(_0xe602xa[_0xdb82[33]]){case _0xdb82[30]:_0xe602x16=_[_0xdb82[26]](_0xe602x12);_0xe602x13=_0xe602x16[_0xdb82[27]]();if(_0xe602x13){_0xe602xa[_0xdb82[28]]=[{id:_0xe602x13[_0xdb82[16]],name:_0xe602x13[_0xdb82[21]]}];_0xe602x15[_0xdb82[29]]({id:_0xe602x13[_0xdb82[16]],name:_0xe602x13[_0xdb82[21]]});saveReport(_0xe602xa)};break;case _0xdb82[32]:_0xe602xa[_0xdb82[28]]=_[_0xdb82[31]](_0xe602x12,_0xe602xf,_0xdb82[21]);saveReport(_0xe602xa);break;default:};_0xe602xe=setTimeout(function(){clearInterval(_0xe602xd);return _0xe602xb(null,false)},_0xe602xa[_0xdb82[24]]*1000);_0xe602xd=setInterval(function(){_0xe602xc+=_0xe602xa[_0xdb82[25]];return Agent[_0xdb82[36]]({where:{id:{$in:_[_0xdb82[22]](_0xe602xa[_0xdb82[35]],_0xdb82[16])},online:true,mailPause:false},include:[{model:MailRoom,attributes:[_0xdb82[16],_0xdb82[18]]}],attributes:[_0xdb82[16],_0xdb82[21],_0xdb82[14]]})[_0xdb82[34]](function(_0xe602x11){_0xe602x12=_[_0xdb82[22]](_[_0xdb82[20]](_0xe602x11,function(_0xe602x13){if(_0xe602x13[_0xdb82[14]]===0){return true}else {return _0xe602x13[_0xdb82[14]]>_[_0xdb82[20]](_0xe602x13.MailRooms,function(_0xe602x14){return _0xe602x14[_0xdb82[16]]!==_0xe602xa[_0xdb82[17]]&&_0xe602x14[_0xdb82[18]]!==_0xdb82[19]})[_0xdb82[15]]}}),function(_0xe602x13){return {id:_0xe602x13[_0xdb82[16]],name:_0xe602x13[_0xdb82[21]]}});_0xe602xa[_0xdb82[23]]=((_0xe602xa[_0xdb82[24]]-_0xe602xc)>_0xe602xa[_0xdb82[25]])?_0xe602xa[_0xdb82[25]]:(_0xe602xa[_0xdb82[24]]-_0xe602xc);switch(_0xe602xa[_0xdb82[33]]){case _0xdb82[30]:_0xe602x16=_[_0xdb82[31]](_0xe602x12,_0xe602x15,_0xdb82[21]);_0xe602x16=_[_0xdb82[31]](_0xe602x16,_0xe602xf,_0xdb82[21]);_0xe602x13=_0xe602x16[_0xdb82[27]]();if(_0xe602x13){_0xe602xa[_0xdb82[28]]=[{id:_0xe602x13[_0xdb82[16]],name:_0xe602x13[_0xdb82[21]]}];_0xe602x15[_0xdb82[29]]({id:_0xe602x13[_0xdb82[16]],name:_0xe602x13[_0xdb82[21]]});saveReport(_0xe602xa)}else {_0xe602x15=[];_0xe602x12=_[_0xdb82[31]](_0xe602x12,_0xe602xf,_0xdb82[21]);_0xe602x13=_0xe602x12[_0xdb82[27]]();if(_0xe602x13){_0xe602xa[_0xdb82[28]]=[{id:_0xe602x13[_0xdb82[16]],name:_0xe602x13[_0xdb82[21]]}];_0xe602x15[_0xdb82[29]]({id:_0xe602x13[_0xdb82[16]],name:_0xe602x13[_0xdb82[21]]});saveReport(_0xe602xa)}};break;case _0xdb82[32]:_0xe602xa[_0xdb82[28]]=_[_0xdb82[31]](_0xe602x12,_0xe602xf,_0xdb82[21]);saveReport(_0xe602xa);break;default:}})[_0xdb82[13]](function(_0xe602x10){console[_0xdb82[12]](_0xe602x10)})},_0xe602xa[_0xdb82[25]]*1000)})[_0xdb82[13]](function(_0xe602x10){console[_0xdb82[12]](_0xe602x10)});ReportMail[_0xdb82[51]](function(_0xe602x17){if(_0xe602x17[_0xdb82[38]](_0xdb82[37])){_0xe602xf[_0xdb82[29]]({id:_0xe602x17[_0xdb82[39]],name:_0xe602x17[_0xdb82[40]]})};if(_0xe602x17[_0xdb82[38]](_0xdb82[41])){return MailRoom[_0xdb82[50]](_0xe602x17[_0xdb82[17]])[_0xdb82[34]](function(_0xe602x18){return _0xe602x18[_0xdb82[49]](_0xe602x17[_0xdb82[39]],{individualHooks:true})})[_0xdb82[34]](function(){return ReportMailRoom[_0xdb82[45]]({application:_0xe602x17[_0xdb82[46]],memberid:_0xe602x17[_0xdb82[39]],membername:_0xe602x17[_0xdb82[40]],queue:_0xe602x17[_0xdb82[47]],queuename:_0xe602x17[_0xdb82[48]],leaveAt:moment()[_0xdb82[43]](_0xdb82[42])},{where:{uniqueid:_0xe602x17[_0xdb82[44]],leaveAt:null},individualHooks:true})})[_0xdb82[34]](function(){return ReportMailSession[_0xdb82[45]]({memberid:_0xe602x17[_0xdb82[39]],membername:_0xe602x17[_0xdb82[40]],leaveAt:moment()[_0xdb82[43]](_0xdb82[42])},{where:{uniqueid:_0xe602x17[_0xdb82[44]],leaveAt:null},individualHooks:true})})[_0xdb82[34]](function(){clearInterval(_0xe602xd);clearTimeout(_0xe602xe);return _0xe602xb(null,true)})[_0xdb82[13]](function(_0xe602x10){console[_0xdb82[12]](_0xe602x10)})}});return {}}function saveReport(_0xe602xa){var _0xe602x1a=[];_0xe602xa[_0xdb82[28]][_0xdb82[57]](function(_0xe602x13,_0xe602x1b){_0xe602x1a[_0xdb82[29]]({uniqueid:_0xe602xa[_0xdb82[44]],timeslot:_0xe602xa[_0xdb82[23]],subject:_0xe602xa[_0xdb82[52]],accountid:_0xe602xa[_0xdb82[53]],accountname:_0xe602xa[_0xdb82[54]],accountaddress:_0xe602xa[_0xdb82[55]],application:_0xe602xa[_0xdb82[46]],membername:_0xe602x13[_0xdb82[21]],memberid:_0xe602x13[_0xdb82[16]],queue:_0xe602xa[_0xdb82[47]]||null,queuename:_0xe602xa[_0xdb82[48]]||null,roomid:_0xe602xa[_0xdb82[17]]||null,messageid:_0xe602xa[_0xdb82[56]]||null,calledAt:moment()[_0xdb82[43]](_0xdb82[42])})});if(_0xe602x1a[_0xdb82[15]]){return ReportMail[_0xdb82[58]](_0xe602x1a,{individualHooks:true})[_0xdb82[13]](function(_0xe602x10){console[_0xdb82[12]](_0xe602x10)})}}module[_0xdb82[59]]=Session