Built motion from commit eddce310.|2.6.12
[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 _0x166f=['lodash','../model/mailAccount','mailAccounts','hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','length','merge','exports'];(function(_0x47d6b2,_0x374239){var _0x3367af=function(_0x480d15){while(--_0x480d15){_0x47d6b2['push'](_0x47d6b2['shift']());}};_0x3367af(++_0x374239);}(_0x166f,0x186));var _0xf166=function(_0x24e842,_0x29a1bc){_0x24e842=_0x24e842-0x0;var _0x1d370f=_0x166f[_0x24e842];return _0x1d370f;};'use strict';var _=require(_0xf166('0x0'));var MailAccount=require(_0xf166('0x1'));var Realtime=function(){this[_0xf166('0x2')]={};};function freeIsNotKey(_0x2ffbbc,_0x42e9df,_0xfc5f67){var _0x5d2bce=_['mapKeys'](_0x2ffbbc,function(_0x19abf0,_0x513c98){return _0x19abf0[_0xfc5f67];});for(var _0x4c219e in _0x42e9df){if(_0x42e9df[_0xf166('0x3')](_0x4c219e)){if(!_0x5d2bce[_0x4c219e]){delete _0x42e9df[_0x4c219e];}}}}Realtime[_0xf166('0x4')][_0xf166('0x5')]=function(_0x352f3e,_0x415903){for(var _0x2c8031 in _0x415903){if(_0x352f3e[_0xf166('0x3')](_0x2c8031)){_0x352f3e[_0x2c8031]=_0x415903[_0x2c8031];}}};Realtime[_0xf166('0x4')][_0xf166('0x6')]=function(){var _0x48be8a=this;return function(_0x5950d2){if(_0x5950d2){freeIsNotKey(_0x5950d2,_0x48be8a[_0xf166('0x2')],'id');for(var _0x1e9e95=0x0,_0xba190a={},_0x1eb76f={};_0x1e9e95<_0x5950d2[_0xf166('0x7')];_0x1e9e95+=0x1){_0xba190a=_0x5950d2[_0x1e9e95];if(_['isUndefined'](_0x48be8a['mailAccounts'][_0xba190a['id']])){_0x48be8a[_0xf166('0x2')][_0xba190a['id']]=new MailAccount(_0xba190a);}else{_[_0xf166('0x8')](_0x48be8a['mailAccounts'][_0xba190a['id']],_0xba190a);}}}return _0x48be8a[_0xf166('0x2')];};};module[_0xf166('0x9')]=Realtime;