Built motion from commit (unavailable).|2.5.14
[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 _0x0db4=['mapKeys','prototype','hasOwnProperty','initMailAccounts','length','isUndefined','mailAccounts','exports','lodash'];(function(_0x3b9a48,_0x14fc96){var _0x14be91=function(_0x58d2e2){while(--_0x58d2e2){_0x3b9a48['push'](_0x3b9a48['shift']());}};_0x14be91(++_0x14fc96);}(_0x0db4,0x131));var _0x40db=function(_0xf79bae,_0x263b2a){_0xf79bae=_0xf79bae-0x0;var _0x5d2cb7=_0x0db4[_0xf79bae];return _0x5d2cb7;};'use strict';var _=require(_0x40db('0x0'));var MailAccount=require('../model/mailAccount');var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0xabf08a,_0x354700,_0x13339b){var _0x4e4933=_[_0x40db('0x1')](_0xabf08a,function(_0x2d21b4,_0x2ac6cc){return _0x2d21b4[_0x13339b];});for(var _0x35d0a1 in _0x354700){if(_0x354700['hasOwnProperty'](_0x35d0a1)){if(!_0x4e4933[_0x35d0a1]){delete _0x354700[_0x35d0a1];}}}}Realtime[_0x40db('0x2')]['mergeFromDatabase']=function(_0x568ad6,_0x5b6790){for(var _0x1c6786 in _0x5b6790){if(_0x568ad6[_0x40db('0x3')](_0x1c6786)){_0x568ad6[_0x1c6786]=_0x5b6790[_0x1c6786];}}};Realtime['prototype'][_0x40db('0x4')]=function(){var _0x58ccbf=this;return function(_0x588db8){if(_0x588db8){freeIsNotKey(_0x588db8,_0x58ccbf['mailAccounts'],'id');for(var _0x5f1228=0x0,_0x4483fa={},_0x6c4bad={};_0x5f1228<_0x588db8[_0x40db('0x5')];_0x5f1228+=0x1){_0x4483fa=_0x588db8[_0x5f1228];if(_[_0x40db('0x6')](_0x58ccbf['mailAccounts'][_0x4483fa['id']])){_0x58ccbf[_0x40db('0x7')][_0x4483fa['id']]=new MailAccount(_0x4483fa);}else{_['merge'](_0x58ccbf[_0x40db('0x7')][_0x4483fa['id']],_0x4483fa);}}}return _0x58ccbf[_0x40db('0x7')];};};module[_0x40db('0x8')]=Realtime;