Built motion from commit f3da74b7.|2.5.36
[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 _0x861e=['isUndefined','merge','exports','lodash','mailAccounts','mapKeys','prototype','mergeFromDatabase','hasOwnProperty','length'];(function(_0x45c8d8,_0x432aa9){var _0x355fa0=function(_0xb13007){while(--_0xb13007){_0x45c8d8['push'](_0x45c8d8['shift']());}};_0x355fa0(++_0x432aa9);}(_0x861e,0x12f));var _0xe861=function(_0x58be73,_0x2118fc){_0x58be73=_0x58be73-0x0;var _0x28c3f1=_0x861e[_0x58be73];return _0x28c3f1;};'use strict';var _=require(_0xe861('0x0'));var MailAccount=require('../model/mailAccount');var Realtime=function(){this[_0xe861('0x1')]={};};function freeIsNotKey(_0x23d734,_0x3e2375,_0x5537c5){var _0x1d02df=_[_0xe861('0x2')](_0x23d734,function(_0x11d26c,_0x3ee004){return _0x11d26c[_0x5537c5];});for(var _0x2e2c94 in _0x3e2375){if(_0x3e2375['hasOwnProperty'](_0x2e2c94)){if(!_0x1d02df[_0x2e2c94]){delete _0x3e2375[_0x2e2c94];}}}}Realtime[_0xe861('0x3')][_0xe861('0x4')]=function(_0x3ea6cc,_0x37020f){for(var _0x3f10de in _0x37020f){if(_0x3ea6cc[_0xe861('0x5')](_0x3f10de)){_0x3ea6cc[_0x3f10de]=_0x37020f[_0x3f10de];}}};Realtime['prototype']['initMailAccounts']=function(){var _0x3219bf=this;return function(_0x11ae3c){if(_0x11ae3c){freeIsNotKey(_0x11ae3c,_0x3219bf[_0xe861('0x1')],'id');for(var _0x1f4eac=0x0,_0x14d677={},_0x5514d2={};_0x1f4eac<_0x11ae3c[_0xe861('0x6')];_0x1f4eac+=0x1){_0x14d677=_0x11ae3c[_0x1f4eac];if(_[_0xe861('0x7')](_0x3219bf[_0xe861('0x1')][_0x14d677['id']])){_0x3219bf[_0xe861('0x1')][_0x14d677['id']]=new MailAccount(_0x14d677);}else{_[_0xe861('0x8')](_0x3219bf[_0xe861('0x1')][_0x14d677['id']],_0x14d677);}}}return _0x3219bf[_0xe861('0x1')];};};module[_0xe861('0x9')]=Realtime;