3af7c8bc5401652199595d62736c3523f4d35136
[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 _0xa400=['hasOwnProperty','initMailAccounts','isUndefined','merge','exports','lodash','../model/mailAccount','mailAccounts','mapKeys'];(function(_0x4388a4,_0x26711a){var _0x1dc511=function(_0xffb4f4){while(--_0xffb4f4){_0x4388a4['push'](_0x4388a4['shift']());}};_0x1dc511(++_0x26711a);}(_0xa400,0x15b));var _0x0a40=function(_0x3e3e7c,_0x838cb9){_0x3e3e7c=_0x3e3e7c-0x0;var _0x54e746=_0xa400[_0x3e3e7c];return _0x54e746;};'use strict';var _=require(_0x0a40('0x0'));var MailAccount=require(_0x0a40('0x1'));var Realtime=function(){this[_0x0a40('0x2')]={};};function freeIsNotKey(_0x6105c4,_0x1aef4d,_0x47f6a8){var _0x40c52c=_[_0x0a40('0x3')](_0x6105c4,function(_0x2279b7,_0x2269b7){return _0x2279b7[_0x47f6a8];});for(var _0x5a6a3a in _0x1aef4d){if(_0x1aef4d[_0x0a40('0x4')](_0x5a6a3a)){if(!_0x40c52c[_0x5a6a3a]){delete _0x1aef4d[_0x5a6a3a];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x492a7f,_0x4feadb){for(var _0x42084c in _0x4feadb){if(_0x492a7f[_0x0a40('0x4')](_0x42084c)){_0x492a7f[_0x42084c]=_0x4feadb[_0x42084c];}}};Realtime['prototype'][_0x0a40('0x5')]=function(){var _0x56ef36=this;return function(_0x18f660){if(_0x18f660){freeIsNotKey(_0x18f660,_0x56ef36[_0x0a40('0x2')],'id');for(var _0x56ae80=0x0,_0x508c10={},_0x5e311f={};_0x56ae80<_0x18f660['length'];_0x56ae80+=0x1){_0x508c10=_0x18f660[_0x56ae80];if(_[_0x0a40('0x6')](_0x56ef36[_0x0a40('0x2')][_0x508c10['id']])){_0x56ef36[_0x0a40('0x2')][_0x508c10['id']]=new MailAccount(_0x508c10);}else{_[_0x0a40('0x7')](_0x56ef36[_0x0a40('0x2')][_0x508c10['id']],_0x508c10);}}}return _0x56ef36['mailAccounts'];};};module[_0x0a40('0x8')]=Realtime;