4705cc4a1c45baa16e8f8e7ad647622730e49f9b
[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 _0x295f=['../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','length','exports'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x295f,0x105));var _0xf295=function(_0x5564d9,_0x5c0531){_0x5564d9=_0x5564d9-0x0;var _0x4b5884=_0x295f[_0x5564d9];return _0x4b5884;};'use strict';var _=require('lodash');var MailAccount=require(_0xf295('0x0'));var Realtime=function(){this[_0xf295('0x1')]={};};function freeIsNotKey(_0xd397ea,_0x35ee40,_0x463bd7){var _0x3b581c=_[_0xf295('0x2')](_0xd397ea,function(_0x3ad258,_0x26f152){return _0x3ad258[_0x463bd7];});for(var _0x5564d0 in _0x35ee40){if(_0x35ee40[_0xf295('0x3')](_0x5564d0)){if(!_0x3b581c[_0x5564d0]){delete _0x35ee40[_0x5564d0];}}}}Realtime[_0xf295('0x4')][_0xf295('0x5')]=function(_0x17b004,_0x77dcf9){for(var _0x350255 in _0x77dcf9){if(_0x17b004[_0xf295('0x3')](_0x350255)){_0x17b004[_0x350255]=_0x77dcf9[_0x350255];}}};Realtime[_0xf295('0x4')][_0xf295('0x6')]=function(){var _0x6f7ed0=this;return function(_0x58a2eb){if(_0x58a2eb){freeIsNotKey(_0x58a2eb,_0x6f7ed0[_0xf295('0x1')],'id');for(var _0x3972be=0x0,_0x15d39b={},_0x48c6d8={};_0x3972be<_0x58a2eb[_0xf295('0x7')];_0x3972be+=0x1){_0x15d39b=_0x58a2eb[_0x3972be];if(_['isUndefined'](_0x6f7ed0[_0xf295('0x1')][_0x15d39b['id']])){_0x6f7ed0[_0xf295('0x1')][_0x15d39b['id']]=new MailAccount(_0x15d39b);}else{_['merge'](_0x6f7ed0[_0xf295('0x1')][_0x15d39b['id']],_0x15d39b);}}}return _0x6f7ed0[_0xf295('0x1')];};};module[_0xf295('0x8')]=Realtime;