Built motion from commit b5413ace.|2.6.9
[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 _0xf49a=['../model/mailAccount','hasOwnProperty','mailAccounts','length','merge','exports','lodash'];(function(_0x4b4704,_0x53cbf5){var _0x59b812=function(_0x2857e5){while(--_0x2857e5){_0x4b4704['push'](_0x4b4704['shift']());}};_0x59b812(++_0x53cbf5);}(_0xf49a,0x1bf));var _0xaf49=function(_0x908eb6,_0x59199b){_0x908eb6=_0x908eb6-0x0;var _0x511a09=_0xf49a[_0x908eb6];return _0x511a09;};'use strict';var _=require(_0xaf49('0x0'));var MailAccount=require(_0xaf49('0x1'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x5ccde6,_0x3000fa,_0x435661){var _0x363449=_['mapKeys'](_0x5ccde6,function(_0x55ef8d,_0x4be90d){return _0x55ef8d[_0x435661];});for(var _0x14e531 in _0x3000fa){if(_0x3000fa[_0xaf49('0x2')](_0x14e531)){if(!_0x363449[_0x14e531]){delete _0x3000fa[_0x14e531];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x1e7261,_0x552435){for(var _0x5d0798 in _0x552435){if(_0x1e7261[_0xaf49('0x2')](_0x5d0798)){_0x1e7261[_0x5d0798]=_0x552435[_0x5d0798];}}};Realtime['prototype']['initMailAccounts']=function(){var _0x138bda=this;return function(_0x4c14b1){if(_0x4c14b1){freeIsNotKey(_0x4c14b1,_0x138bda[_0xaf49('0x3')],'id');for(var _0x57e0d0=0x0,_0x579d30={},_0x505494={};_0x57e0d0<_0x4c14b1[_0xaf49('0x4')];_0x57e0d0+=0x1){_0x579d30=_0x4c14b1[_0x57e0d0];if(_['isUndefined'](_0x138bda[_0xaf49('0x3')][_0x579d30['id']])){_0x138bda[_0xaf49('0x3')][_0x579d30['id']]=new MailAccount(_0x579d30);}else{_[_0xaf49('0x5')](_0x138bda[_0xaf49('0x3')][_0x579d30['id']],_0x579d30);}}}return _0x138bda[_0xaf49('0x3')];};};module[_0xaf49('0x6')]=Realtime;