c4aaa57ac7e67a71d17f9ad5e6ad435824a2575f
[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 _0x5cdb=['isUndefined','lodash','../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','length'];(function(_0x4c445a,_0x4ee80f){var _0x2f611c=function(_0x4f3699){while(--_0x4f3699){_0x4c445a['push'](_0x4c445a['shift']());}};_0x2f611c(++_0x4ee80f);}(_0x5cdb,0x137));var _0xb5cd=function(_0x453407,_0x3f8145){_0x453407=_0x453407-0x0;var _0x139f58=_0x5cdb[_0x453407];return _0x139f58;};'use strict';var _=require(_0xb5cd('0x0'));var MailAccount=require(_0xb5cd('0x1'));var Realtime=function(){this[_0xb5cd('0x2')]={};};function freeIsNotKey(_0x2e5b74,_0xb29499,_0x40eb5e){var _0xb7df94=_[_0xb5cd('0x3')](_0x2e5b74,function(_0x2323c8,_0x2bbdaf){return _0x2323c8[_0x40eb5e];});for(var _0x4818e9 in _0xb29499){if(_0xb29499[_0xb5cd('0x4')](_0x4818e9)){if(!_0xb7df94[_0x4818e9]){delete _0xb29499[_0x4818e9];}}}}Realtime[_0xb5cd('0x5')][_0xb5cd('0x6')]=function(_0x2d7072,_0x180faa){for(var _0x347d97 in _0x180faa){if(_0x2d7072['hasOwnProperty'](_0x347d97)){_0x2d7072[_0x347d97]=_0x180faa[_0x347d97];}}};Realtime[_0xb5cd('0x5')][_0xb5cd('0x7')]=function(){var _0x5b22ab=this;return function(_0x30970b){if(_0x30970b){freeIsNotKey(_0x30970b,_0x5b22ab['mailAccounts'],'id');for(var _0x2f04a1=0x0,_0x3f22be={},_0x188e7b={};_0x2f04a1<_0x30970b[_0xb5cd('0x8')];_0x2f04a1+=0x1){_0x3f22be=_0x30970b[_0x2f04a1];if(_[_0xb5cd('0x9')](_0x5b22ab[_0xb5cd('0x2')][_0x3f22be['id']])){_0x5b22ab[_0xb5cd('0x2')][_0x3f22be['id']]=new MailAccount(_0x3f22be);}else{_['merge'](_0x5b22ab['mailAccounts'][_0x3f22be['id']],_0x3f22be);}}}return _0x5b22ab[_0xb5cd('0x2')];};};module['exports']=Realtime;