Built motion from commit 0415ced0.|2.6.28
[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 _0xee86=['mapKeys','hasOwnProperty','prototype','initMailAccounts','lodash','../model/mailAccount','mailAccounts'];(function(_0x2473cd,_0x312432){var _0x31f10f=function(_0x4052b2){while(--_0x4052b2){_0x2473cd['push'](_0x2473cd['shift']());}};_0x31f10f(++_0x312432);}(_0xee86,0xf2));var _0x6ee8=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0xee86[_0x50007c];return _0x5c1ec7;};'use strict';var _=require(_0x6ee8('0x0'));var MailAccount=require(_0x6ee8('0x1'));var Realtime=function(){this[_0x6ee8('0x2')]={};};function freeIsNotKey(_0x29e097,_0x1395f8,_0x6f46c6){var _0x59e7f5=_[_0x6ee8('0x3')](_0x29e097,function(_0xe8888d,_0x3a0ee7){return _0xe8888d[_0x6f46c6];});for(var _0x403f4d in _0x1395f8){if(_0x1395f8[_0x6ee8('0x4')](_0x403f4d)){if(!_0x59e7f5[_0x403f4d]){delete _0x1395f8[_0x403f4d];}}}}Realtime[_0x6ee8('0x5')]['mergeFromDatabase']=function(_0x4df278,_0x59204b){for(var _0x515dbc in _0x59204b){if(_0x4df278['hasOwnProperty'](_0x515dbc)){_0x4df278[_0x515dbc]=_0x59204b[_0x515dbc];}}};Realtime[_0x6ee8('0x5')][_0x6ee8('0x6')]=function(){var _0x4b1ac0=this;return function(_0x27c80d){if(_0x27c80d){freeIsNotKey(_0x27c80d,_0x4b1ac0[_0x6ee8('0x2')],'id');for(var _0x3cb57f=0x0,_0x3b5a34={},_0x349f07={};_0x3cb57f<_0x27c80d['length'];_0x3cb57f+=0x1){_0x3b5a34=_0x27c80d[_0x3cb57f];if(_['isUndefined'](_0x4b1ac0['mailAccounts'][_0x3b5a34['id']])){_0x4b1ac0['mailAccounts'][_0x3b5a34['id']]=new MailAccount(_0x3b5a34);}else{_['merge'](_0x4b1ac0[_0x6ee8('0x2')][_0x3b5a34['id']],_0x3b5a34);}}}return _0x4b1ac0[_0x6ee8('0x2')];};};module['exports']=Realtime;