e574633519de295c71babd34999d14c94ef248e0
[motion2.git] / server / services / email / realtime / index.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 _0xa3c6=['lodash','../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','length','isUndefined','exports'];(function(_0x179271,_0x1469d4){var _0x4cc659=function(_0x5f988c){while(--_0x5f988c){_0x179271['push'](_0x179271['shift']());}};_0x4cc659(++_0x1469d4);}(_0xa3c6,0x1b8));var _0x6a3c=function(_0x531732,_0x5172db){_0x531732=_0x531732-0x0;var _0x3e94f8=_0xa3c6[_0x531732];return _0x3e94f8;};'use strict';var _=require(_0x6a3c('0x0'));var MailAccount=require(_0x6a3c('0x1'));var Realtime=function(){this[_0x6a3c('0x2')]={};};function freeIsNotKey(_0x2ee6e9,_0x196e6b,_0x3f77ba){var _0x21a7df=_[_0x6a3c('0x3')](_0x2ee6e9,function(_0x4177ea,_0x2d1222){return _0x4177ea[_0x3f77ba];});for(var _0x503255 in _0x196e6b){if(_0x196e6b[_0x6a3c('0x4')](_0x503255)){if(!_0x21a7df[_0x503255]){delete _0x196e6b[_0x503255];}}}}Realtime[_0x6a3c('0x5')][_0x6a3c('0x6')]=function(_0x37f689,_0x4ae820){for(var _0x3a9f9c in _0x4ae820){if(_0x37f689[_0x6a3c('0x4')](_0x3a9f9c)){_0x37f689[_0x3a9f9c]=_0x4ae820[_0x3a9f9c];}}};Realtime[_0x6a3c('0x5')]['initMailAccounts']=function(){var _0x417aca=this;return function(_0xd45d78){if(_0xd45d78){freeIsNotKey(_0xd45d78,_0x417aca[_0x6a3c('0x2')],'id');for(var _0x36a250=0x0,_0x831094={},_0x1b2b22={};_0x36a250<_0xd45d78[_0x6a3c('0x7')];_0x36a250+=0x1){_0x831094=_0xd45d78[_0x36a250];if(_[_0x6a3c('0x8')](_0x417aca[_0x6a3c('0x2')][_0x831094['id']])){_0x417aca[_0x6a3c('0x2')][_0x831094['id']]=new MailAccount(_0x831094);}else{_['merge'](_0x417aca[_0x6a3c('0x2')][_0x831094['id']],_0x831094);}}}return _0x417aca[_0x6a3c('0x2')];};};module[_0x6a3c('0x9')]=Realtime;