eddf52496246b347120ca4c78ab665964536305a
[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 _0xcbb9=['exports','lodash','../model/mailAccount','mailAccounts','hasOwnProperty','mergeFromDatabase','prototype','initMailAccounts','length','isUndefined','merge'];(function(_0x35c150,_0x4c91fa){var _0x1d1012=function(_0x3aeb02){while(--_0x3aeb02){_0x35c150['push'](_0x35c150['shift']());}};_0x1d1012(++_0x4c91fa);}(_0xcbb9,0xb1));var _0x9cbb=function(_0x488bb5,_0x54ad83){_0x488bb5=_0x488bb5-0x0;var _0x9ab55=_0xcbb9[_0x488bb5];return _0x9ab55;};'use strict';var _=require(_0x9cbb('0x0'));var MailAccount=require(_0x9cbb('0x1'));var Realtime=function(){this[_0x9cbb('0x2')]={};};function freeIsNotKey(_0x21591f,_0x44d760,_0x757168){var _0x183a08=_['mapKeys'](_0x21591f,function(_0x4df319,_0x4cbcdb){return _0x4df319[_0x757168];});for(var _0x5c4bf5 in _0x44d760){if(_0x44d760[_0x9cbb('0x3')](_0x5c4bf5)){if(!_0x183a08[_0x5c4bf5]){delete _0x44d760[_0x5c4bf5];}}}}Realtime['prototype'][_0x9cbb('0x4')]=function(_0x19ece8,_0x30b838){for(var _0x1e629e in _0x30b838){if(_0x19ece8['hasOwnProperty'](_0x1e629e)){_0x19ece8[_0x1e629e]=_0x30b838[_0x1e629e];}}};Realtime[_0x9cbb('0x5')][_0x9cbb('0x6')]=function(){var _0x487de8=this;return function(_0x4e64df){if(_0x4e64df){freeIsNotKey(_0x4e64df,_0x487de8[_0x9cbb('0x2')],'id');for(var _0x5df4a4=0x0,_0x45396b={},_0x296b51={};_0x5df4a4<_0x4e64df[_0x9cbb('0x7')];_0x5df4a4+=0x1){_0x45396b=_0x4e64df[_0x5df4a4];if(_[_0x9cbb('0x8')](_0x487de8[_0x9cbb('0x2')][_0x45396b['id']])){_0x487de8[_0x9cbb('0x2')][_0x45396b['id']]=new MailAccount(_0x45396b);}else{_[_0x9cbb('0x9')](_0x487de8['mailAccounts'][_0x45396b['id']],_0x45396b);}}}return _0x487de8['mailAccounts'];};};module[_0x9cbb('0xa')]=Realtime;