// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x8f20=['events','../../mysqldb','MailInteraction','setMaxListeners','save','update','getUsers','setDataValue','Users','map','findAll','then','unreadMessages','length','emit','catch','hasOwnProperty'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8f20,0x1dc));var _0x08f2=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x8f20[_0xefd519];return _0x4bb882;};'use strict';var EventEmitter=require(_0x08f2('0x0'));var MailInteraction=require(_0x08f2('0x1'))['db'][_0x08f2('0x2')];var MailMessage=require(_0x08f2('0x1'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x08f2('0x3')](0x0);var events={'afterCreate':_0x08f2('0x4'),'afterUpdate':_0x08f2('0x5'),'afterDestroy':'remove'};function emitEvent(_0x431579){return function(_0x5cd86e,_0x34b311,_0x3fb6f3){_0x5cd86e[_0x08f2('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x1fc246){_0x5cd86e[_0x08f2('0x7')](_0x08f2('0x8'),_0x1fc246[_0x08f2('0x9')](function(_0xdba5b){return{'id':_0xdba5b['id']};}));return MailMessage[_0x08f2('0xa')]({'where':{'MailInteractionId':_0x5cd86e['id'],'direction':'in','read':![]},'raw':!![]});})[_0x08f2('0xb')](function(_0x5f549b){_0x5cd86e[_0x08f2('0x7')](_0x08f2('0xc'),_0x5f549b[_0x08f2('0xd')]);MailInteractionEvents[_0x08f2('0xe')](_0x431579+':'+_0x5cd86e['id'],_0x5cd86e);MailInteractionEvents[_0x08f2('0xe')](_0x431579,_0x5cd86e);_0x3fb6f3(null);})[_0x08f2('0xf')](_0x3fb6f3(null));};}for(var e in events){if(events[_0x08f2('0x10')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module['exports']=MailInteractionEvents;
\ No newline at end of file
+var _0xdc45=['hook','MailInteraction','../../mysqldb','setMaxListeners','save','remove','getUsers','then','setDataValue','Users','map','findAll','length','emit','catch','hasOwnProperty'];(function(_0x5ca5bc,_0x5b8a9d){var _0x26ca86=function(_0x1ad9a6){while(--_0x1ad9a6){_0x5ca5bc['push'](_0x5ca5bc['shift']());}};_0x26ca86(++_0x5b8a9d);}(_0xdc45,0xc1));var _0x5dc4=function(_0x4e19ec,_0x5aa2c8){_0x4e19ec=_0x4e19ec-0x0;var _0x1bf0ab=_0xdc45[_0x4e19ec];return _0x1bf0ab;};'use strict';var EventEmitter=require('events');var MailInteraction=require('../../mysqldb')['db'][_0x5dc4('0x0')];var MailMessage=require(_0x5dc4('0x1'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x5dc4('0x2')](0x0);var events={'afterCreate':_0x5dc4('0x3'),'afterUpdate':'update','afterDestroy':_0x5dc4('0x4')};function emitEvent(_0x11aac8){return function(_0x5e4d0b,_0x36107e,_0xf91e69){_0x5e4d0b[_0x5dc4('0x5')]({'attributes':['id'],'raw':!![]})[_0x5dc4('0x6')](function(_0x3b5ef0){_0x5e4d0b[_0x5dc4('0x7')](_0x5dc4('0x8'),_0x3b5ef0[_0x5dc4('0x9')](function(_0x65bbb5){return{'id':_0x65bbb5['id']};}));return MailMessage[_0x5dc4('0xa')]({'where':{'MailInteractionId':_0x5e4d0b['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x5edc9d){_0x5e4d0b['setDataValue']('unreadMessages',_0x5edc9d[_0x5dc4('0xb')]);MailInteractionEvents[_0x5dc4('0xc')](_0x11aac8+':'+_0x5e4d0b['id'],_0x5e4d0b);MailInteractionEvents['emit'](_0x11aac8,_0x5e4d0b);_0xf91e69(null);})[_0x5dc4('0xd')](_0xf91e69(null));};}for(var e in events){if(events[_0x5dc4('0xe')](e)){var event=events[e];MailInteraction[_0x5dc4('0xf')](e,emitEvent(event));}}module['exports']=MailInteractionEvents;
\ No newline at end of file