Built motion from commit 85328c08.|2.5.50
[motion2.git] / server / api / cmContact / cmContact.events.js
1 // *************************************************************************
2 // *                                                                       *
3 // * xCALLY Motion -  The Omnichannel Contact Center                       *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved                     *
5 // *                                                                       *
6 // *************************************************************************
7 // *                                                                       *
8 // * Email: info@xcally.com                                                *
9 // * Website: https://www.xcally.com                                       *
10 // *                                                                       *
11 // *************************************************************************
12 // *                                                                       *
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.                         *
16 // *                                                                       *
17 // *************************************************************************
18 var _0xcc61=['exports','../../mysqldb','CmContact','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x523c49,_0x5de9ee){var _0x5b2b05=function(_0x4be375){while(--_0x4be375){_0x523c49['push'](_0x523c49['shift']());}};_0x5b2b05(++_0x5de9ee);}(_0xcc61,0x9a));var _0x1cc6=function(_0x301c40,_0x30438e){_0x301c40=_0x301c40-0x0;var _0x19df97=_0xcc61[_0x301c40];return _0x19df97;};'use strict';var EventEmitter=require('events');var CmContact=require(_0x1cc6('0x0'))['db'][_0x1cc6('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1cc6('0x2'),'afterUpdate':_0x1cc6('0x3'),'afterDestroy':_0x1cc6('0x4')};function emitEvent(_0x56fdc5){return function(_0x4bf4b8,_0x2aa22a,_0x40fa0e){CmContactEvents[_0x1cc6('0x5')](_0x56fdc5+':'+_0x4bf4b8['id'],_0x4bf4b8);CmContactEvents[_0x1cc6('0x5')](_0x56fdc5,_0x4bf4b8);_0x40fa0e(null);};}for(var e in events){if(events[_0x1cc6('0x6')](e)){var event=events[e];CmContact[_0x1cc6('0x7')](e,emitEvent(event));}}module[_0x1cc6('0x8')]=CmContactEvents;