1 // *************************************************************************
3 // * xCALLY Motion - The Omnichannel Contact Center *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved *
6 // *************************************************************************
8 // * Email: info@xcally.com *
9 // * Website: https://www.xcally.com *
11 // *************************************************************************
13 // * The SOFTWARE PRODUCT is protected by copyright laws and international *
14 // * copyright treaties, as well as other intellectual property laws and *
15 // * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
17 // *************************************************************************
18 var _0xdcc0=['update','emit','hook','exports','events','../../mysqldb','ChatMessage','setMaxListeners','save'];(function(_0x51a498,_0xa0fef5){var _0x55fbfa=function(_0x4df789){while(--_0x4df789){_0x51a498['push'](_0x51a498['shift']());}};_0x55fbfa(++_0xa0fef5);}(_0xdcc0,0x70));var _0x0dcc=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xdcc0[_0x2f5ac5];return _0x37c9a8;};'use strict';var EventEmitter=require(_0x0dcc('0x0'));var ChatMessage=require(_0x0dcc('0x1'))['db'][_0x0dcc('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x0dcc('0x3')](0x0);var events={'afterCreate':_0x0dcc('0x4'),'afterUpdate':_0x0dcc('0x5'),'afterDestroy':'remove'};function emitEvent(_0x25b330){return function(_0x2db2c7,_0xe10249,_0x4a903c){ChatMessageEvents['emit'](_0x25b330+':'+_0x2db2c7['id'],_0x2db2c7);ChatMessageEvents[_0x0dcc('0x6')](_0x25b330,_0x2db2c7);_0x4a903c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0x0dcc('0x7')](e,emitEvent(event));}}module[_0x0dcc('0x8')]=ChatMessageEvents;