38b35a2e88d2982a23c04fce0c05fe1d7e7ac013
[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 _0x990c=['prototype','initMailAccounts','length','isUndefined','lodash','../model/mailAccount','mailAccounts','hasOwnProperty'];(function(_0x4c7fb5,_0x2548ef){var _0x2e10ac=function(_0xf7e27c){while(--_0xf7e27c){_0x4c7fb5['push'](_0x4c7fb5['shift']());}};_0x2e10ac(++_0x2548ef);}(_0x990c,0x94));var _0xc990=function(_0x4928c6,_0x1f6379){_0x4928c6=_0x4928c6-0x0;var _0x1ca244=_0x990c[_0x4928c6];return _0x1ca244;};'use strict';var _=require(_0xc990('0x0'));var MailAccount=require(_0xc990('0x1'));var Realtime=function(){this[_0xc990('0x2')]={};};function freeIsNotKey(_0x22fbb5,_0x312263,_0x3c7f88){var _0x2e98a6=_['mapKeys'](_0x22fbb5,function(_0x5ee7ed,_0x45c61c){return _0x5ee7ed[_0x3c7f88];});for(var _0x130d7f in _0x312263){if(_0x312263[_0xc990('0x3')](_0x130d7f)){if(!_0x2e98a6[_0x130d7f]){delete _0x312263[_0x130d7f];}}}}Realtime[_0xc990('0x4')]['mergeFromDatabase']=function(_0xa32479,_0x14843a){for(var _0x3848c2 in _0x14843a){if(_0xa32479[_0xc990('0x3')](_0x3848c2)){_0xa32479[_0x3848c2]=_0x14843a[_0x3848c2];}}};Realtime[_0xc990('0x4')][_0xc990('0x5')]=function(){var _0x142efe=this;return function(_0x50c2a6){if(_0x50c2a6){freeIsNotKey(_0x50c2a6,_0x142efe[_0xc990('0x2')],'id');for(var _0xa2a7bb=0x0,_0x17f6e2={},_0x2cad5f={};_0xa2a7bb<_0x50c2a6[_0xc990('0x6')];_0xa2a7bb+=0x1){_0x17f6e2=_0x50c2a6[_0xa2a7bb];if(_[_0xc990('0x7')](_0x142efe[_0xc990('0x2')][_0x17f6e2['id']])){_0x142efe[_0xc990('0x2')][_0x17f6e2['id']]=new MailAccount(_0x17f6e2);}else{_['merge'](_0x142efe[_0xc990('0x2')][_0x17f6e2['id']],_0x17f6e2);}}}return _0x142efe[_0xc990('0x2')];};};module['exports']=Realtime;