Built motion from commit a679711e.|2.6.15
[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 _0x5c6e=['merge','exports','../model/mailAccount','mapKeys','hasOwnProperty','prototype','initMailAccounts','mailAccounts','length'];(function(_0x215954,_0x59b51e){var _0x2f8a10=function(_0x5f0033){while(--_0x5f0033){_0x215954['push'](_0x215954['shift']());}};_0x2f8a10(++_0x59b51e);}(_0x5c6e,0xc8));var _0xe5c6=function(_0x5c1345,_0x40116e){_0x5c1345=_0x5c1345-0x0;var _0x1c070d=_0x5c6e[_0x5c1345];return _0x1c070d;};'use strict';var _=require('lodash');var MailAccount=require(_0xe5c6('0x0'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x551fa0,_0x259b43,_0x54eaab){var _0x1e9bee=_[_0xe5c6('0x1')](_0x551fa0,function(_0x323c6e,_0x20935d){return _0x323c6e[_0x54eaab];});for(var _0xc33c91 in _0x259b43){if(_0x259b43[_0xe5c6('0x2')](_0xc33c91)){if(!_0x1e9bee[_0xc33c91]){delete _0x259b43[_0xc33c91];}}}}Realtime[_0xe5c6('0x3')]['mergeFromDatabase']=function(_0x5ade0e,_0x5bde10){for(var _0x598bd4 in _0x5bde10){if(_0x5ade0e[_0xe5c6('0x2')](_0x598bd4)){_0x5ade0e[_0x598bd4]=_0x5bde10[_0x598bd4];}}};Realtime[_0xe5c6('0x3')][_0xe5c6('0x4')]=function(){var _0x4afc84=this;return function(_0x4465bc){if(_0x4465bc){freeIsNotKey(_0x4465bc,_0x4afc84[_0xe5c6('0x5')],'id');for(var _0x526c53=0x0,_0x12242c={},_0x4749dd={};_0x526c53<_0x4465bc[_0xe5c6('0x6')];_0x526c53+=0x1){_0x12242c=_0x4465bc[_0x526c53];if(_['isUndefined'](_0x4afc84[_0xe5c6('0x5')][_0x12242c['id']])){_0x4afc84[_0xe5c6('0x5')][_0x12242c['id']]=new MailAccount(_0x12242c);}else{_[_0xe5c6('0x7')](_0x4afc84[_0xe5c6('0x5')][_0x12242c['id']],_0x12242c);}}}return _0x4afc84[_0xe5c6('0x5')];};};module[_0xe5c6('0x8')]=Realtime;