Built motion from commit 3e059bc2.|2.5.32
[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 _0xf098=['merge','exports','../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty','mergeFromDatabase','prototype','length','isUndefined'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xf098,0x84));var _0x8f09=function(_0x3ff4d2,_0x36d6bb){_0x3ff4d2=_0x3ff4d2-0x0;var _0x42a394=_0xf098[_0x3ff4d2];return _0x42a394;};'use strict';var _=require('lodash');var MailAccount=require(_0x8f09('0x0'));var Realtime=function(){this[_0x8f09('0x1')]={};};function freeIsNotKey(_0x181f9f,_0x3e7e91,_0x35d62f){var _0x3ed84a=_[_0x8f09('0x2')](_0x181f9f,function(_0xa87113,_0xa1860c){return _0xa87113[_0x35d62f];});for(var _0x19b3a1 in _0x3e7e91){if(_0x3e7e91[_0x8f09('0x3')](_0x19b3a1)){if(!_0x3ed84a[_0x19b3a1]){delete _0x3e7e91[_0x19b3a1];}}}}Realtime['prototype'][_0x8f09('0x4')]=function(_0x2b6893,_0x44a4c2){for(var _0x146409 in _0x44a4c2){if(_0x2b6893[_0x8f09('0x3')](_0x146409)){_0x2b6893[_0x146409]=_0x44a4c2[_0x146409];}}};Realtime[_0x8f09('0x5')]['initMailAccounts']=function(){var _0x4a9a4c=this;return function(_0x15f036){if(_0x15f036){freeIsNotKey(_0x15f036,_0x4a9a4c[_0x8f09('0x1')],'id');for(var _0x790d6e=0x0,_0x22aecd={},_0x4cec73={};_0x790d6e<_0x15f036[_0x8f09('0x6')];_0x790d6e+=0x1){_0x22aecd=_0x15f036[_0x790d6e];if(_[_0x8f09('0x7')](_0x4a9a4c[_0x8f09('0x1')][_0x22aecd['id']])){_0x4a9a4c[_0x8f09('0x1')][_0x22aecd['id']]=new MailAccount(_0x22aecd);}else{_[_0x8f09('0x8')](_0x4a9a4c['mailAccounts'][_0x22aecd['id']],_0x22aecd);}}}return _0x4a9a4c['mailAccounts'];};};module[_0x8f09('0x9')]=Realtime;