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 _0x0ca3=['mailAccounts','prototype','hasOwnProperty','initMailAccounts','length','isUndefined','merge','exports','../model/mailAccount'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0ca3,0xd7));var _0x30ca=function(_0x264b9b,_0xa1181e){_0x264b9b=_0x264b9b-0x0;var _0x4c7a0e=_0x0ca3[_0x264b9b];return _0x4c7a0e;};'use strict';var _=require('lodash');var MailAccount=require(_0x30ca('0x0'));var Realtime=function(){this[_0x30ca('0x1')]={};};function freeIsNotKey(_0x2a62d8,_0x3e4463,_0x409c89){var _0x17c4c1=_['mapKeys'](_0x2a62d8,function(_0x18cbea,_0xda49b9){return _0x18cbea[_0x409c89];});for(var _0x2136f in _0x3e4463){if(_0x3e4463['hasOwnProperty'](_0x2136f)){if(!_0x17c4c1[_0x2136f]){delete _0x3e4463[_0x2136f];}}}}Realtime[_0x30ca('0x2')]['mergeFromDatabase']=function(_0x7e5416,_0x28fe86){for(var _0x4d2a1c in _0x28fe86){if(_0x7e5416[_0x30ca('0x3')](_0x4d2a1c)){_0x7e5416[_0x4d2a1c]=_0x28fe86[_0x4d2a1c];}}};Realtime[_0x30ca('0x2')][_0x30ca('0x4')]=function(){var _0x156a23=this;return function(_0xd1c897){if(_0xd1c897){freeIsNotKey(_0xd1c897,_0x156a23[_0x30ca('0x1')],'id');for(var _0x348144=0x0,_0x17f7c6={},_0xf4d186={};_0x348144<_0xd1c897[_0x30ca('0x5')];_0x348144+=0x1){_0x17f7c6=_0xd1c897[_0x348144];if(_[_0x30ca('0x6')](_0x156a23[_0x30ca('0x1')][_0x17f7c6['id']])){_0x156a23[_0x30ca('0x1')][_0x17f7c6['id']]=new MailAccount(_0x17f7c6);}else{_[_0x30ca('0x7')](_0x156a23[_0x30ca('0x1')][_0x17f7c6['id']],_0x17f7c6);}}}return _0x156a23[_0x30ca('0x1')];};};module[_0x30ca('0x8')]=Realtime;