Built motion from commit 85328c08.|2.5.50
[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 _0xa5ea=['prototype','mergeFromDatabase','hasOwnProperty','initMailAccounts','length','isUndefined','lodash','mailAccounts','mapKeys'];(function(_0x478a19,_0x2ff359){var _0x7fd2fa=function(_0x2aeb50){while(--_0x2aeb50){_0x478a19['push'](_0x478a19['shift']());}};_0x7fd2fa(++_0x2ff359);}(_0xa5ea,0xa8));var _0xaa5e=function(_0x367fcb,_0x26a793){_0x367fcb=_0x367fcb-0x0;var _0xbd6cfe=_0xa5ea[_0x367fcb];return _0xbd6cfe;};'use strict';var _=require(_0xaa5e('0x0'));var MailAccount=require('../model/mailAccount');var Realtime=function(){this[_0xaa5e('0x1')]={};};function freeIsNotKey(_0x24b60c,_0x480bcc,_0x81612f){var _0x2b8df8=_[_0xaa5e('0x2')](_0x24b60c,function(_0x3f172e,_0x536049){return _0x3f172e[_0x81612f];});for(var _0x5427a8 in _0x480bcc){if(_0x480bcc['hasOwnProperty'](_0x5427a8)){if(!_0x2b8df8[_0x5427a8]){delete _0x480bcc[_0x5427a8];}}}}Realtime[_0xaa5e('0x3')][_0xaa5e('0x4')]=function(_0x47510c,_0x5cdec7){for(var _0x27348e in _0x5cdec7){if(_0x47510c[_0xaa5e('0x5')](_0x27348e)){_0x47510c[_0x27348e]=_0x5cdec7[_0x27348e];}}};Realtime[_0xaa5e('0x3')][_0xaa5e('0x6')]=function(){var _0x1775f9=this;return function(_0x15c801){if(_0x15c801){freeIsNotKey(_0x15c801,_0x1775f9[_0xaa5e('0x1')],'id');for(var _0x3349b0=0x0,_0x36e16a={},_0x4b4066={};_0x3349b0<_0x15c801[_0xaa5e('0x7')];_0x3349b0+=0x1){_0x36e16a=_0x15c801[_0x3349b0];if(_[_0xaa5e('0x8')](_0x1775f9[_0xaa5e('0x1')][_0x36e16a['id']])){_0x1775f9[_0xaa5e('0x1')][_0x36e16a['id']]=new MailAccount(_0x36e16a);}else{_['merge'](_0x1775f9[_0xaa5e('0x1')][_0x36e16a['id']],_0x36e16a);}}}return _0x1775f9[_0xaa5e('0x1')];};};module['exports']=Realtime;