6175f60c965a2458a273d12e3788fae8e9755324
[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 _0xd774=['setMaxListeners','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','MailAccount'];(function(_0x15ca1a,_0x30fc82){var _0x507626=function(_0x14c9bc){while(--_0x14c9bc){_0x15ca1a['push'](_0x15ca1a['shift']());}};_0x507626(++_0x30fc82);}(_0xd774,0x19b));var _0x4d77=function(_0x40292d,_0x53934d){_0x40292d=_0x40292d-0x0;var _0xa83cb4=_0xd774[_0x40292d];return _0xa83cb4;};'use strict';var EventEmitter=require(_0x4d77('0x0'));var MailAccount=require(_0x4d77('0x1'))['db'][_0x4d77('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x4d77('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4d77('0x4'),'afterDestroy':_0x4d77('0x5')};function emitEvent(_0x4604e7){return function(_0x120bac,_0x5481ee,_0x3543cb){MailAccountEvents[_0x4d77('0x6')](_0x4604e7+':'+_0x120bac['id'],_0x120bac);MailAccountEvents[_0x4d77('0x6')](_0x4604e7,_0x120bac);_0x3543cb(null);};}for(var e in events){if(events[_0x4d77('0x7')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0x4d77('0x8')]=MailAccountEvents;