Built motion from commit 00bf23f6.|2.6.16
[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 _0x4f10=['hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','length','isUndefined','exports','lodash','mailAccounts','mapKeys'];(function(_0x270340,_0x368e68){var _0x6074e8=function(_0x102ba7){while(--_0x102ba7){_0x270340['push'](_0x270340['shift']());}};_0x6074e8(++_0x368e68);}(_0x4f10,0x89));var _0x04f1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4f10[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x04f1('0x0'));var MailAccount=require('../model/mailAccount');var Realtime=function(){this[_0x04f1('0x1')]={};};function freeIsNotKey(_0x11f9e3,_0x3afe3c,_0x2d4968){var _0x464513=_[_0x04f1('0x2')](_0x11f9e3,function(_0x961358,_0x2c7404){return _0x961358[_0x2d4968];});for(var _0x1deae1 in _0x3afe3c){if(_0x3afe3c[_0x04f1('0x3')](_0x1deae1)){if(!_0x464513[_0x1deae1]){delete _0x3afe3c[_0x1deae1];}}}}Realtime[_0x04f1('0x4')][_0x04f1('0x5')]=function(_0x22f6a8,_0x2c5cc5){for(var _0x196b08 in _0x2c5cc5){if(_0x22f6a8[_0x04f1('0x3')](_0x196b08)){_0x22f6a8[_0x196b08]=_0x2c5cc5[_0x196b08];}}};Realtime['prototype'][_0x04f1('0x6')]=function(){var _0x554a9e=this;return function(_0x14fae2){if(_0x14fae2){freeIsNotKey(_0x14fae2,_0x554a9e[_0x04f1('0x1')],'id');for(var _0x307f6b=0x0,_0x1e4fcd={},_0x1f2a08={};_0x307f6b<_0x14fae2[_0x04f1('0x7')];_0x307f6b+=0x1){_0x1e4fcd=_0x14fae2[_0x307f6b];if(_[_0x04f1('0x8')](_0x554a9e[_0x04f1('0x1')][_0x1e4fcd['id']])){_0x554a9e[_0x04f1('0x1')][_0x1e4fcd['id']]=new MailAccount(_0x1e4fcd);}else{_['merge'](_0x554a9e['mailAccounts'][_0x1e4fcd['id']],_0x1e4fcd);}}}return _0x554a9e[_0x04f1('0x1')];};};module[_0x04f1('0x9')]=Realtime;