21cfc4f3d7973436cf2e76bfa789e9b5a2aac896
[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 _0xc7a9=['exports','lodash','../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty','mergeFromDatabase','prototype','length'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xc7a9,0x1e7));var _0x9c7a=function(_0x2327c5,_0x17a738){_0x2327c5=_0x2327c5-0x0;var _0x24fab3=_0xc7a9[_0x2327c5];return _0x24fab3;};'use strict';var _=require(_0x9c7a('0x0'));var MailAccount=require(_0x9c7a('0x1'));var Realtime=function(){this[_0x9c7a('0x2')]={};};function freeIsNotKey(_0xaf7854,_0x31bec8,_0x3e235d){var _0x482508=_[_0x9c7a('0x3')](_0xaf7854,function(_0x25186c,_0x175b00){return _0x25186c[_0x3e235d];});for(var _0x8b4073 in _0x31bec8){if(_0x31bec8[_0x9c7a('0x4')](_0x8b4073)){if(!_0x482508[_0x8b4073]){delete _0x31bec8[_0x8b4073];}}}}Realtime['prototype'][_0x9c7a('0x5')]=function(_0x28d203,_0x3f9223){for(var _0xefdae5 in _0x3f9223){if(_0x28d203['hasOwnProperty'](_0xefdae5)){_0x28d203[_0xefdae5]=_0x3f9223[_0xefdae5];}}};Realtime[_0x9c7a('0x6')]['initMailAccounts']=function(){var _0x304f12=this;return function(_0x4ec05f){if(_0x4ec05f){freeIsNotKey(_0x4ec05f,_0x304f12[_0x9c7a('0x2')],'id');for(var _0x2d4511=0x0,_0x5ac3cf={},_0x43abf5={};_0x2d4511<_0x4ec05f[_0x9c7a('0x7')];_0x2d4511+=0x1){_0x5ac3cf=_0x4ec05f[_0x2d4511];if(_['isUndefined'](_0x304f12[_0x9c7a('0x2')][_0x5ac3cf['id']])){_0x304f12[_0x9c7a('0x2')][_0x5ac3cf['id']]=new MailAccount(_0x5ac3cf);}else{_['merge'](_0x304f12[_0x9c7a('0x2')][_0x5ac3cf['id']],_0x5ac3cf);}}}return _0x304f12[_0x9c7a('0x2')];};};module[_0x9c7a('0x8')]=Realtime;