Built motion from commit (unavailable).|2.4.13
[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 _0x7446=['exports','lodash','../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','isUndefined'];(function(_0x1151c9,_0x58734d){var _0x477f5c=function(_0x417cc4){while(--_0x417cc4){_0x1151c9['push'](_0x1151c9['shift']());}};_0x477f5c(++_0x58734d);}(_0x7446,0x79));var _0x6744=function(_0x87e244,_0x3087fd){_0x87e244=_0x87e244-0x0;var _0x83a833=_0x7446[_0x87e244];return _0x83a833;};'use strict';var _=require(_0x6744('0x0'));var MailAccount=require(_0x6744('0x1'));var Realtime=function(){this[_0x6744('0x2')]={};};function freeIsNotKey(_0x3f5f11,_0xd294f,_0x109731){var _0x5ed049=_[_0x6744('0x3')](_0x3f5f11,function(_0xaff53e,_0xfea7ce){return _0xaff53e[_0x109731];});for(var _0x223329 in _0xd294f){if(_0xd294f[_0x6744('0x4')](_0x223329)){if(!_0x5ed049[_0x223329]){delete _0xd294f[_0x223329];}}}}Realtime[_0x6744('0x5')][_0x6744('0x6')]=function(_0x9d821a,_0x5f547d){for(var _0x10bd3f in _0x5f547d){if(_0x9d821a[_0x6744('0x4')](_0x10bd3f)){_0x9d821a[_0x10bd3f]=_0x5f547d[_0x10bd3f];}}};Realtime[_0x6744('0x5')][_0x6744('0x7')]=function(){var _0x54568c=this;return function(_0x45c808){if(_0x45c808){freeIsNotKey(_0x45c808,_0x54568c[_0x6744('0x2')],'id');for(var _0x33d5c2=0x0,_0x951db0={},_0x4c5cc2={};_0x33d5c2<_0x45c808['length'];_0x33d5c2+=0x1){_0x951db0=_0x45c808[_0x33d5c2];if(_[_0x6744('0x8')](_0x54568c['mailAccounts'][_0x951db0['id']])){_0x54568c[_0x6744('0x2')][_0x951db0['id']]=new MailAccount(_0x951db0);}else{_['merge'](_0x54568c[_0x6744('0x2')][_0x951db0['id']],_0x951db0);}}}return _0x54568c[_0x6744('0x2')];};};module[_0x6744('0x9')]=Realtime;