9b0c710928aa042fa993162dd06c6bef1fd88b15
[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 _0xfa8d=['isUndefined','merge','exports','../model/mailAccount','hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','mailAccounts'];(function(_0x861f0,_0x53366d){var _0x415bf4=function(_0x566778){while(--_0x566778){_0x861f0['push'](_0x861f0['shift']());}};_0x415bf4(++_0x53366d);}(_0xfa8d,0x159));var _0xdfa8=function(_0x15b01f,_0x4e7556){_0x15b01f=_0x15b01f-0x0;var _0x4f4d0a=_0xfa8d[_0x15b01f];return _0x4f4d0a;};'use strict';var _=require('lodash');var MailAccount=require(_0xdfa8('0x0'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x141c39,_0x104967,_0x35f106){var _0x28e2b8=_['mapKeys'](_0x141c39,function(_0x4198fd,_0x102abb){return _0x4198fd[_0x35f106];});for(var _0x59de4e in _0x104967){if(_0x104967[_0xdfa8('0x1')](_0x59de4e)){if(!_0x28e2b8[_0x59de4e]){delete _0x104967[_0x59de4e];}}}}Realtime[_0xdfa8('0x2')][_0xdfa8('0x3')]=function(_0x51b761,_0xe5fdf6){for(var _0x15bbd6 in _0xe5fdf6){if(_0x51b761['hasOwnProperty'](_0x15bbd6)){_0x51b761[_0x15bbd6]=_0xe5fdf6[_0x15bbd6];}}};Realtime[_0xdfa8('0x2')][_0xdfa8('0x4')]=function(){var _0x463ed2=this;return function(_0x2422c1){if(_0x2422c1){freeIsNotKey(_0x2422c1,_0x463ed2[_0xdfa8('0x5')],'id');for(var _0x58fa83=0x0,_0x21f418={},_0x59b793={};_0x58fa83<_0x2422c1['length'];_0x58fa83+=0x1){_0x21f418=_0x2422c1[_0x58fa83];if(_[_0xdfa8('0x6')](_0x463ed2[_0xdfa8('0x5')][_0x21f418['id']])){_0x463ed2[_0xdfa8('0x5')][_0x21f418['id']]=new MailAccount(_0x21f418);}else{_[_0xdfa8('0x7')](_0x463ed2[_0xdfa8('0x5')][_0x21f418['id']],_0x21f418);}}}return _0x463ed2[_0xdfa8('0x5')];};};module[_0xdfa8('0x8')]=Realtime;