Built motion from commit (unavailable).|2.5.8
[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 _0x0d38=['mailAccounts','hasOwnProperty','mergeFromDatabase','prototype','initMailAccounts','length','merge','exports','lodash','../model/mailAccount'];(function(_0x426a43,_0x191826){var _0x473fce=function(_0x1edcc0){while(--_0x1edcc0){_0x426a43['push'](_0x426a43['shift']());}};_0x473fce(++_0x191826);}(_0x0d38,0xe4));var _0x80d3=function(_0x32b87c,_0x289af6){_0x32b87c=_0x32b87c-0x0;var _0x46da18=_0x0d38[_0x32b87c];return _0x46da18;};'use strict';var _=require(_0x80d3('0x0'));var MailAccount=require(_0x80d3('0x1'));var Realtime=function(){this[_0x80d3('0x2')]={};};function freeIsNotKey(_0x123410,_0x2a7486,_0x10f66c){var _0x592eb0=_['mapKeys'](_0x123410,function(_0x13b68a,_0x1da831){return _0x13b68a[_0x10f66c];});for(var _0x498af1 in _0x2a7486){if(_0x2a7486[_0x80d3('0x3')](_0x498af1)){if(!_0x592eb0[_0x498af1]){delete _0x2a7486[_0x498af1];}}}}Realtime['prototype'][_0x80d3('0x4')]=function(_0x344c73,_0x4e6520){for(var _0x32c347 in _0x4e6520){if(_0x344c73[_0x80d3('0x3')](_0x32c347)){_0x344c73[_0x32c347]=_0x4e6520[_0x32c347];}}};Realtime[_0x80d3('0x5')][_0x80d3('0x6')]=function(){var _0x2df1ca=this;return function(_0x4de137){if(_0x4de137){freeIsNotKey(_0x4de137,_0x2df1ca['mailAccounts'],'id');for(var _0x2b40d9=0x0,_0x295f9b={},_0x5c7d3b={};_0x2b40d9<_0x4de137[_0x80d3('0x7')];_0x2b40d9+=0x1){_0x295f9b=_0x4de137[_0x2b40d9];if(_['isUndefined'](_0x2df1ca[_0x80d3('0x2')][_0x295f9b['id']])){_0x2df1ca['mailAccounts'][_0x295f9b['id']]=new MailAccount(_0x295f9b);}else{_[_0x80d3('0x8')](_0x2df1ca[_0x80d3('0x2')][_0x295f9b['id']],_0x295f9b);}}}return _0x2df1ca[_0x80d3('0x2')];};};module[_0x80d3('0x9')]=Realtime;