Built motion from commit 753c950e.|2.5.42
[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 _0xfcf8=['mapKeys','prototype','mergeFromDatabase','hasOwnProperty','initMailAccounts','length','isUndefined','exports','lodash','../model/mailAccount','mailAccounts'];(function(_0x28bef9,_0x28e8d6){var _0x45db81=function(_0x269033){while(--_0x269033){_0x28bef9['push'](_0x28bef9['shift']());}};_0x45db81(++_0x28e8d6);}(_0xfcf8,0x1c0));var _0x8fcf=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0xfcf8[_0x15bc81];return _0x59440e;};'use strict';var _=require(_0x8fcf('0x0'));var MailAccount=require(_0x8fcf('0x1'));var Realtime=function(){this[_0x8fcf('0x2')]={};};function freeIsNotKey(_0xa5863b,_0x41c530,_0x4d429d){var _0x23bf53=_[_0x8fcf('0x3')](_0xa5863b,function(_0x326440,_0x592e1c){return _0x326440[_0x4d429d];});for(var _0x129f37 in _0x41c530){if(_0x41c530['hasOwnProperty'](_0x129f37)){if(!_0x23bf53[_0x129f37]){delete _0x41c530[_0x129f37];}}}}Realtime[_0x8fcf('0x4')][_0x8fcf('0x5')]=function(_0x374cd5,_0x2cd4a8){for(var _0x5d1635 in _0x2cd4a8){if(_0x374cd5[_0x8fcf('0x6')](_0x5d1635)){_0x374cd5[_0x5d1635]=_0x2cd4a8[_0x5d1635];}}};Realtime[_0x8fcf('0x4')][_0x8fcf('0x7')]=function(){var _0xed4798=this;return function(_0x366035){if(_0x366035){freeIsNotKey(_0x366035,_0xed4798['mailAccounts'],'id');for(var _0x453e11=0x0,_0x2a20b0={},_0x19872c={};_0x453e11<_0x366035[_0x8fcf('0x8')];_0x453e11+=0x1){_0x2a20b0=_0x366035[_0x453e11];if(_[_0x8fcf('0x9')](_0xed4798[_0x8fcf('0x2')][_0x2a20b0['id']])){_0xed4798['mailAccounts'][_0x2a20b0['id']]=new MailAccount(_0x2a20b0);}else{_['merge'](_0xed4798[_0x8fcf('0x2')][_0x2a20b0['id']],_0x2a20b0);}}}return _0xed4798['mailAccounts'];};};module[_0x8fcf('0xa')]=Realtime;