be31fa8df1c2f183209887edf44d49993b67cd3f
[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 _0x0db7=['MailAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x59eb11,_0x5e7c1e){var _0x35fb0c=function(_0x426325){while(--_0x426325){_0x59eb11['push'](_0x59eb11['shift']());}};_0x35fb0c(++_0x5e7c1e);}(_0x0db7,0x80));var _0x70db=function(_0x441c64,_0x19b184){_0x441c64=_0x441c64-0x0;var _0x37017e=_0x0db7[_0x441c64];return _0x37017e;};'use strict';var EventEmitter=require(_0x70db('0x0'));var MailAccount=require(_0x70db('0x1'))['db'][_0x70db('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x70db('0x3')](0x0);var events={'afterCreate':_0x70db('0x4'),'afterUpdate':_0x70db('0x5'),'afterDestroy':_0x70db('0x6')};function emitEvent(_0x1e6bfe){return function(_0x3f592c,_0x1d599b,_0x656ce6){MailAccountEvents[_0x70db('0x7')](_0x1e6bfe+':'+_0x3f592c['id'],_0x3f592c);MailAccountEvents[_0x70db('0x7')](_0x1e6bfe,_0x3f592c);_0x656ce6(null);};}for(var e in events){if(events[_0x70db('0x8')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0x70db('0x9')]=MailAccountEvents;