58ee93a7990af9b33e2a652ee477dc5c96b05cd4
[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 _0xc017=['exports','lodash','../model/mailAccount','mailAccounts','mapKeys','mergeFromDatabase','hasOwnProperty','prototype','isUndefined','merge'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc017,0x119));var _0x7c01=function(_0xafb8e6,_0x4b3a6b){_0xafb8e6=_0xafb8e6-0x0;var _0x36eec3=_0xc017[_0xafb8e6];return _0x36eec3;};'use strict';var _=require(_0x7c01('0x0'));var MailAccount=require(_0x7c01('0x1'));var Realtime=function(){this[_0x7c01('0x2')]={};};function freeIsNotKey(_0x28b2ee,_0x3d096f,_0x22b4b4){var _0x4c9a95=_[_0x7c01('0x3')](_0x28b2ee,function(_0x3ab361,_0x3b517c){return _0x3ab361[_0x22b4b4];});for(var _0xc911eb in _0x3d096f){if(_0x3d096f['hasOwnProperty'](_0xc911eb)){if(!_0x4c9a95[_0xc911eb]){delete _0x3d096f[_0xc911eb];}}}}Realtime['prototype'][_0x7c01('0x4')]=function(_0x1960f9,_0x104a38){for(var _0x4a11ae in _0x104a38){if(_0x1960f9[_0x7c01('0x5')](_0x4a11ae)){_0x1960f9[_0x4a11ae]=_0x104a38[_0x4a11ae];}}};Realtime[_0x7c01('0x6')]['initMailAccounts']=function(){var _0x3939e2=this;return function(_0x35ede8){if(_0x35ede8){freeIsNotKey(_0x35ede8,_0x3939e2[_0x7c01('0x2')],'id');for(var _0x115686=0x0,_0x4ba2f0={},_0x10e23e={};_0x115686<_0x35ede8['length'];_0x115686+=0x1){_0x4ba2f0=_0x35ede8[_0x115686];if(_[_0x7c01('0x7')](_0x3939e2['mailAccounts'][_0x4ba2f0['id']])){_0x3939e2[_0x7c01('0x2')][_0x4ba2f0['id']]=new MailAccount(_0x4ba2f0);}else{_[_0x7c01('0x8')](_0x3939e2[_0x7c01('0x2')][_0x4ba2f0['id']],_0x4ba2f0);}}}return _0x3939e2[_0x7c01('0x2')];};};module[_0x7c01('0x9')]=Realtime;