44898910446b4582fd5faa1cddb39abbc49dd8d1
[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 _0x7a97=['prototype','mergeFromDatabase','mailAccounts','length','isUndefined','exports','lodash','../model/mailAccount','hasOwnProperty'];(function(_0x5e74e0,_0x53b3fb){var _0x2f64d0=function(_0x27bfc4){while(--_0x27bfc4){_0x5e74e0['push'](_0x5e74e0['shift']());}};_0x2f64d0(++_0x53b3fb);}(_0x7a97,0xb1));var _0x77a9=function(_0x3fb73d,_0x2cdbbc){_0x3fb73d=_0x3fb73d-0x0;var _0xa55ede=_0x7a97[_0x3fb73d];return _0xa55ede;};'use strict';var _=require(_0x77a9('0x0'));var MailAccount=require(_0x77a9('0x1'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x5a5345,_0x4750e7,_0x5b1d14){var _0x4d0aa0=_['mapKeys'](_0x5a5345,function(_0x34c657,_0x5836fe){return _0x34c657[_0x5b1d14];});for(var _0x3f0f28 in _0x4750e7){if(_0x4750e7[_0x77a9('0x2')](_0x3f0f28)){if(!_0x4d0aa0[_0x3f0f28]){delete _0x4750e7[_0x3f0f28];}}}}Realtime[_0x77a9('0x3')][_0x77a9('0x4')]=function(_0x2c1ad6,_0x4f2740){for(var _0x4f8995 in _0x4f2740){if(_0x2c1ad6[_0x77a9('0x2')](_0x4f8995)){_0x2c1ad6[_0x4f8995]=_0x4f2740[_0x4f8995];}}};Realtime[_0x77a9('0x3')]['initMailAccounts']=function(){var _0x1ea1ed=this;return function(_0x59b16f){if(_0x59b16f){freeIsNotKey(_0x59b16f,_0x1ea1ed[_0x77a9('0x5')],'id');for(var _0x1e4446=0x0,_0x40eb1b={},_0x19c392={};_0x1e4446<_0x59b16f[_0x77a9('0x6')];_0x1e4446+=0x1){_0x40eb1b=_0x59b16f[_0x1e4446];if(_[_0x77a9('0x7')](_0x1ea1ed['mailAccounts'][_0x40eb1b['id']])){_0x1ea1ed[_0x77a9('0x5')][_0x40eb1b['id']]=new MailAccount(_0x40eb1b);}else{_['merge'](_0x1ea1ed[_0x77a9('0x5')][_0x40eb1b['id']],_0x40eb1b);}}}return _0x1ea1ed['mailAccounts'];};};module[_0x77a9('0x8')]=Realtime;