Built motion from commit 06eb8eb0.|2.6.31
[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 _0xb6fe=['mapKeys','hasOwnProperty','prototype','mergeFromDatabase','mailAccounts','merge','exports','../model/mailAccount'];(function(_0x3bbaa4,_0x40f004){var _0x53c1c7=function(_0x2dfc79){while(--_0x2dfc79){_0x3bbaa4['push'](_0x3bbaa4['shift']());}};_0x53c1c7(++_0x40f004);}(_0xb6fe,0x7f));var _0xeb6f=function(_0x308213,_0x224541){_0x308213=_0x308213-0x0;var _0x2e1619=_0xb6fe[_0x308213];return _0x2e1619;};'use strict';var _=require('lodash');var MailAccount=require(_0xeb6f('0x0'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x1618b9,_0x3547d9,_0x344cbe){var _0x5525ef=_[_0xeb6f('0x1')](_0x1618b9,function(_0xd9e6f9,_0x2dc753){return _0xd9e6f9[_0x344cbe];});for(var _0x997921 in _0x3547d9){if(_0x3547d9[_0xeb6f('0x2')](_0x997921)){if(!_0x5525ef[_0x997921]){delete _0x3547d9[_0x997921];}}}}Realtime[_0xeb6f('0x3')][_0xeb6f('0x4')]=function(_0x65f23e,_0x1a6cfc){for(var _0x253b43 in _0x1a6cfc){if(_0x65f23e[_0xeb6f('0x2')](_0x253b43)){_0x65f23e[_0x253b43]=_0x1a6cfc[_0x253b43];}}};Realtime[_0xeb6f('0x3')]['initMailAccounts']=function(){var _0x22d539=this;return function(_0x32948c){if(_0x32948c){freeIsNotKey(_0x32948c,_0x22d539[_0xeb6f('0x5')],'id');for(var _0x489a47=0x0,_0x328aaa={},_0x1cb766={};_0x489a47<_0x32948c['length'];_0x489a47+=0x1){_0x328aaa=_0x32948c[_0x489a47];if(_['isUndefined'](_0x22d539[_0xeb6f('0x5')][_0x328aaa['id']])){_0x22d539[_0xeb6f('0x5')][_0x328aaa['id']]=new MailAccount(_0x328aaa);}else{_[_0xeb6f('0x6')](_0x22d539[_0xeb6f('0x5')][_0x328aaa['id']],_0x328aaa);}}}return _0x22d539[_0xeb6f('0x5')];};};module[_0xeb6f('0x7')]=Realtime;