Built motion from commit 0900f080.|2.5.45
[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 _0x1e80=['isUndefined','merge','lodash','../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty','prototype','initMailAccounts','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1e80,0x1e2));var _0x01e8=function(_0x21207e,_0x488728){_0x21207e=_0x21207e-0x0;var _0x50a67e=_0x1e80[_0x21207e];return _0x50a67e;};'use strict';var _=require(_0x01e8('0x0'));var MailAccount=require(_0x01e8('0x1'));var Realtime=function(){this[_0x01e8('0x2')]={};};function freeIsNotKey(_0x32599e,_0x18481a,_0x592ed7){var _0x257bfd=_[_0x01e8('0x3')](_0x32599e,function(_0x41f9a4,_0x24175d){return _0x41f9a4[_0x592ed7];});for(var _0x50257a in _0x18481a){if(_0x18481a[_0x01e8('0x4')](_0x50257a)){if(!_0x257bfd[_0x50257a]){delete _0x18481a[_0x50257a];}}}}Realtime[_0x01e8('0x5')]['mergeFromDatabase']=function(_0x5b3c2e,_0x4fcf1c){for(var _0x35089e in _0x4fcf1c){if(_0x5b3c2e[_0x01e8('0x4')](_0x35089e)){_0x5b3c2e[_0x35089e]=_0x4fcf1c[_0x35089e];}}};Realtime[_0x01e8('0x5')][_0x01e8('0x6')]=function(){var _0x16f2c0=this;return function(_0x27e13c){if(_0x27e13c){freeIsNotKey(_0x27e13c,_0x16f2c0[_0x01e8('0x2')],'id');for(var _0x8c4b5f=0x0,_0x18fc7f={},_0x25404f={};_0x8c4b5f<_0x27e13c[_0x01e8('0x7')];_0x8c4b5f+=0x1){_0x18fc7f=_0x27e13c[_0x8c4b5f];if(_[_0x01e8('0x8')](_0x16f2c0[_0x01e8('0x2')][_0x18fc7f['id']])){_0x16f2c0['mailAccounts'][_0x18fc7f['id']]=new MailAccount(_0x18fc7f);}else{_[_0x01e8('0x9')](_0x16f2c0[_0x01e8('0x2')][_0x18fc7f['id']],_0x18fc7f);}}}return _0x16f2c0[_0x01e8('0x2')];};};module['exports']=Realtime;