Built motion from commit b5996064.|2.6.21
[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 _0x3793=['isUndefined','lodash','../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','length'];(function(_0x101e7b,_0x4ef05b){var _0x4995c0=function(_0x1a6488){while(--_0x1a6488){_0x101e7b['push'](_0x101e7b['shift']());}};_0x4995c0(++_0x4ef05b);}(_0x3793,0xf1));var _0x3379=function(_0x10ac3e,_0x28aee3){_0x10ac3e=_0x10ac3e-0x0;var _0x284796=_0x3793[_0x10ac3e];return _0x284796;};'use strict';var _=require(_0x3379('0x0'));var MailAccount=require(_0x3379('0x1'));var Realtime=function(){this[_0x3379('0x2')]={};};function freeIsNotKey(_0x34efff,_0x4dfa09,_0x4ec3b0){var _0x5a6938=_[_0x3379('0x3')](_0x34efff,function(_0x2bf5be,_0xee059a){return _0x2bf5be[_0x4ec3b0];});for(var _0x458012 in _0x4dfa09){if(_0x4dfa09[_0x3379('0x4')](_0x458012)){if(!_0x5a6938[_0x458012]){delete _0x4dfa09[_0x458012];}}}}Realtime[_0x3379('0x5')][_0x3379('0x6')]=function(_0x7d22b2,_0x20fe1d){for(var _0x355cf in _0x20fe1d){if(_0x7d22b2['hasOwnProperty'](_0x355cf)){_0x7d22b2[_0x355cf]=_0x20fe1d[_0x355cf];}}};Realtime['prototype'][_0x3379('0x7')]=function(){var _0x22605f=this;return function(_0x434dc8){if(_0x434dc8){freeIsNotKey(_0x434dc8,_0x22605f[_0x3379('0x2')],'id');for(var _0x4e2ed7=0x0,_0x4281f9={},_0x3d69bb={};_0x4e2ed7<_0x434dc8[_0x3379('0x8')];_0x4e2ed7+=0x1){_0x4281f9=_0x434dc8[_0x4e2ed7];if(_[_0x3379('0x9')](_0x22605f[_0x3379('0x2')][_0x4281f9['id']])){_0x22605f[_0x3379('0x2')][_0x4281f9['id']]=new MailAccount(_0x4281f9);}else{_['merge'](_0x22605f['mailAccounts'][_0x4281f9['id']],_0x4281f9);}}}return _0x22605f[_0x3379('0x2')];};};module['exports']=Realtime;