3340cfbf39cd79312a1ba4999f7b00052964ea77
[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 _0xef36=['lodash','../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','length','merge','exports'];(function(_0x329be9,_0x2ddf46){var _0x5cabec=function(_0x2fcb7c){while(--_0x2fcb7c){_0x329be9['push'](_0x329be9['shift']());}};_0x5cabec(++_0x2ddf46);}(_0xef36,0xc6));var _0x6ef3=function(_0x43bd34,_0x135298){_0x43bd34=_0x43bd34-0x0;var _0xf8a2e9=_0xef36[_0x43bd34];return _0xf8a2e9;};'use strict';var _=require(_0x6ef3('0x0'));var MailAccount=require(_0x6ef3('0x1'));var Realtime=function(){this[_0x6ef3('0x2')]={};};function freeIsNotKey(_0x50a6c2,_0x218875,_0x327613){var _0x230c99=_[_0x6ef3('0x3')](_0x50a6c2,function(_0xeee2c,_0x200c66){return _0xeee2c[_0x327613];});for(var _0x478cc1 in _0x218875){if(_0x218875[_0x6ef3('0x4')](_0x478cc1)){if(!_0x230c99[_0x478cc1]){delete _0x218875[_0x478cc1];}}}}Realtime[_0x6ef3('0x5')][_0x6ef3('0x6')]=function(_0x34d24d,_0x1f0b2e){for(var _0x37afd3 in _0x1f0b2e){if(_0x34d24d[_0x6ef3('0x4')](_0x37afd3)){_0x34d24d[_0x37afd3]=_0x1f0b2e[_0x37afd3];}}};Realtime['prototype'][_0x6ef3('0x7')]=function(){var _0x2e86ce=this;return function(_0x33d80b){if(_0x33d80b){freeIsNotKey(_0x33d80b,_0x2e86ce[_0x6ef3('0x2')],'id');for(var _0x1a8656=0x0,_0x4fa8ac={},_0x52b3b9={};_0x1a8656<_0x33d80b[_0x6ef3('0x8')];_0x1a8656+=0x1){_0x4fa8ac=_0x33d80b[_0x1a8656];if(_['isUndefined'](_0x2e86ce['mailAccounts'][_0x4fa8ac['id']])){_0x2e86ce[_0x6ef3('0x2')][_0x4fa8ac['id']]=new MailAccount(_0x4fa8ac);}else{_[_0x6ef3('0x9')](_0x2e86ce[_0x6ef3('0x2')][_0x4fa8ac['id']],_0x4fa8ac);}}}return _0x2e86ce[_0x6ef3('0x2')];};};module[_0x6ef3('0xa')]=Realtime;