171af4ee2404156f2aa749027da9fe51b3ed9801
[motion2.git] / server / api / mailAccount / mailAccount.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 _0xdbc1=['hook','events','../../mysqldb','MailAccount','setMaxListeners','save','update','remove','emit'];(function(_0x150a69,_0x1b9494){var _0x12b4c0=function(_0x466df7){while(--_0x466df7){_0x150a69['push'](_0x150a69['shift']());}};_0x12b4c0(++_0x1b9494);}(_0xdbc1,0xa3));var _0x1dbc=function(_0x1b3e32,_0x49ad74){_0x1b3e32=_0x1b3e32-0x0;var _0x4796e3=_0xdbc1[_0x1b3e32];return _0x4796e3;};'use strict';var EventEmitter=require(_0x1dbc('0x0'));var MailAccount=require(_0x1dbc('0x1'))['db'][_0x1dbc('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x1dbc('0x3')](0x0);var events={'afterCreate':_0x1dbc('0x4'),'afterUpdate':_0x1dbc('0x5'),'afterDestroy':_0x1dbc('0x6')};function emitEvent(_0x53011e){return function(_0x5a00af,_0x218468,_0x37b6e5){MailAccountEvents[_0x1dbc('0x7')](_0x53011e+':'+_0x5a00af['id'],_0x5a00af);MailAccountEvents['emit'](_0x53011e,_0x5a00af);_0x37b6e5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount[_0x1dbc('0x8')](e,emitEvent(event));}}module['exports']=MailAccountEvents;