Built motion from commit f7863d46.|2.5.41
[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 _0x973e=['mailAccounts','mapKeys','prototype','mergeFromDatabase','hasOwnProperty','length','isUndefined','lodash','../model/mailAccount'];(function(_0x26cf8c,_0x194c67){var _0x2739e6=function(_0x469169){while(--_0x469169){_0x26cf8c['push'](_0x26cf8c['shift']());}};_0x2739e6(++_0x194c67);}(_0x973e,0x193));var _0xe973=function(_0x3ce24c,_0x2f360b){_0x3ce24c=_0x3ce24c-0x0;var _0x11dffb=_0x973e[_0x3ce24c];return _0x11dffb;};'use strict';var _=require(_0xe973('0x0'));var MailAccount=require(_0xe973('0x1'));var Realtime=function(){this[_0xe973('0x2')]={};};function freeIsNotKey(_0x28b77d,_0x43daeb,_0x54ac8f){var _0x5bc561=_[_0xe973('0x3')](_0x28b77d,function(_0x24c711,_0x3d5387){return _0x24c711[_0x54ac8f];});for(var _0x838cab in _0x43daeb){if(_0x43daeb['hasOwnProperty'](_0x838cab)){if(!_0x5bc561[_0x838cab]){delete _0x43daeb[_0x838cab];}}}}Realtime[_0xe973('0x4')][_0xe973('0x5')]=function(_0x596f45,_0x3aa8f2){for(var _0x4525d2 in _0x3aa8f2){if(_0x596f45[_0xe973('0x6')](_0x4525d2)){_0x596f45[_0x4525d2]=_0x3aa8f2[_0x4525d2];}}};Realtime['prototype']['initMailAccounts']=function(){var _0xf0fc8d=this;return function(_0x4b82a8){if(_0x4b82a8){freeIsNotKey(_0x4b82a8,_0xf0fc8d[_0xe973('0x2')],'id');for(var _0x37f8e0=0x0,_0xa4f635={},_0x2f5446={};_0x37f8e0<_0x4b82a8[_0xe973('0x7')];_0x37f8e0+=0x1){_0xa4f635=_0x4b82a8[_0x37f8e0];if(_[_0xe973('0x8')](_0xf0fc8d[_0xe973('0x2')][_0xa4f635['id']])){_0xf0fc8d['mailAccounts'][_0xa4f635['id']]=new MailAccount(_0xa4f635);}else{_['merge'](_0xf0fc8d[_0xe973('0x2')][_0xa4f635['id']],_0xa4f635);}}}return _0xf0fc8d[_0xe973('0x2')];};};module['exports']=Realtime;