Built motion from commit (unavailable).|2.5.3
[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 _0xcc3d=['exports','../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty','mergeFromDatabase','prototype','length','isUndefined'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xcc3d,0x106));var _0xdcc3=function(_0x4fe747,_0x197dd7){_0x4fe747=_0x4fe747-0x0;var _0x15549f=_0xcc3d[_0x4fe747];return _0x15549f;};'use strict';var _=require('lodash');var MailAccount=require(_0xdcc3('0x0'));var Realtime=function(){this[_0xdcc3('0x1')]={};};function freeIsNotKey(_0x1ae328,_0x3dc589,_0x5bf68d){var _0xf30cb9=_[_0xdcc3('0x2')](_0x1ae328,function(_0x54e2f9,_0xb53be0){return _0x54e2f9[_0x5bf68d];});for(var _0x28ef32 in _0x3dc589){if(_0x3dc589[_0xdcc3('0x3')](_0x28ef32)){if(!_0xf30cb9[_0x28ef32]){delete _0x3dc589[_0x28ef32];}}}}Realtime['prototype'][_0xdcc3('0x4')]=function(_0x179b70,_0x3b65e0){for(var _0x10cddc in _0x3b65e0){if(_0x179b70[_0xdcc3('0x3')](_0x10cddc)){_0x179b70[_0x10cddc]=_0x3b65e0[_0x10cddc];}}};Realtime[_0xdcc3('0x5')]['initMailAccounts']=function(){var _0x11fe8f=this;return function(_0x35ee2f){if(_0x35ee2f){freeIsNotKey(_0x35ee2f,_0x11fe8f[_0xdcc3('0x1')],'id');for(var _0xb0400a=0x0,_0x58980c={},_0xcf2a51={};_0xb0400a<_0x35ee2f[_0xdcc3('0x6')];_0xb0400a+=0x1){_0x58980c=_0x35ee2f[_0xb0400a];if(_[_0xdcc3('0x7')](_0x11fe8f[_0xdcc3('0x1')][_0x58980c['id']])){_0x11fe8f['mailAccounts'][_0x58980c['id']]=new MailAccount(_0x58980c);}else{_['merge'](_0x11fe8f[_0xdcc3('0x1')][_0x58980c['id']],_0x58980c);}}}return _0x11fe8f[_0xdcc3('0x1')];};};module[_0xdcc3('0x8')]=Realtime;