4ba9fb5afd8a8799955e8afcc890c4662232de7a
[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 _0x1e8d=['merge','lodash','mailAccounts','mapKeys','mergeFromDatabase','hasOwnProperty','prototype','length','isUndefined'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x1e8d,0x184));var _0xd1e8=function(_0x359d58,_0x12c35b){_0x359d58=_0x359d58-0x0;var _0x394aec=_0x1e8d[_0x359d58];return _0x394aec;};'use strict';var _=require(_0xd1e8('0x0'));var MailAccount=require('../model/mailAccount');var Realtime=function(){this[_0xd1e8('0x1')]={};};function freeIsNotKey(_0x99ae2e,_0xb92b84,_0x19e6fd){var _0x5e5ffc=_[_0xd1e8('0x2')](_0x99ae2e,function(_0x48e3a3,_0x281777){return _0x48e3a3[_0x19e6fd];});for(var _0x1469fa in _0xb92b84){if(_0xb92b84['hasOwnProperty'](_0x1469fa)){if(!_0x5e5ffc[_0x1469fa]){delete _0xb92b84[_0x1469fa];}}}}Realtime['prototype'][_0xd1e8('0x3')]=function(_0x22111d,_0x26a9bb){for(var _0x3d698f in _0x26a9bb){if(_0x22111d[_0xd1e8('0x4')](_0x3d698f)){_0x22111d[_0x3d698f]=_0x26a9bb[_0x3d698f];}}};Realtime[_0xd1e8('0x5')]['initMailAccounts']=function(){var _0xcb4f4c=this;return function(_0x82297){if(_0x82297){freeIsNotKey(_0x82297,_0xcb4f4c[_0xd1e8('0x1')],'id');for(var _0x587d09=0x0,_0x27b89e={},_0x331d11={};_0x587d09<_0x82297[_0xd1e8('0x6')];_0x587d09+=0x1){_0x27b89e=_0x82297[_0x587d09];if(_[_0xd1e8('0x7')](_0xcb4f4c[_0xd1e8('0x1')][_0x27b89e['id']])){_0xcb4f4c[_0xd1e8('0x1')][_0x27b89e['id']]=new MailAccount(_0x27b89e);}else{_[_0xd1e8('0x8')](_0xcb4f4c['mailAccounts'][_0x27b89e['id']],_0x27b89e);}}}return _0xcb4f4c[_0xd1e8('0x1')];};};module['exports']=Realtime;