Built motion from commit bab6f49e.|2.6.17
[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 _0x7bf1=['merge','exports','lodash','../model/mailAccount','mapKeys','hasOwnProperty','prototype','initMailAccounts','mailAccounts','length','isUndefined'];(function(_0x241714,_0x2fdfcf){var _0x406279=function(_0x5d4319){while(--_0x5d4319){_0x241714['push'](_0x241714['shift']());}};_0x406279(++_0x2fdfcf);}(_0x7bf1,0x65));var _0x17bf=function(_0xe7ab3,_0x1ac24a){_0xe7ab3=_0xe7ab3-0x0;var _0x3e484a=_0x7bf1[_0xe7ab3];return _0x3e484a;};'use strict';var _=require(_0x17bf('0x0'));var MailAccount=require(_0x17bf('0x1'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x35269b,_0x2fd8ea,_0x233a14){var _0x5c59a6=_[_0x17bf('0x2')](_0x35269b,function(_0x41290e,_0x230c00){return _0x41290e[_0x233a14];});for(var _0x34dca8 in _0x2fd8ea){if(_0x2fd8ea[_0x17bf('0x3')](_0x34dca8)){if(!_0x5c59a6[_0x34dca8]){delete _0x2fd8ea[_0x34dca8];}}}}Realtime[_0x17bf('0x4')]['mergeFromDatabase']=function(_0x16533f,_0xf55b40){for(var _0x3f87fe in _0xf55b40){if(_0x16533f[_0x17bf('0x3')](_0x3f87fe)){_0x16533f[_0x3f87fe]=_0xf55b40[_0x3f87fe];}}};Realtime[_0x17bf('0x4')][_0x17bf('0x5')]=function(){var _0x198a6d=this;return function(_0x4b2a4a){if(_0x4b2a4a){freeIsNotKey(_0x4b2a4a,_0x198a6d[_0x17bf('0x6')],'id');for(var _0x5861b3=0x0,_0xaa2550={},_0x287583={};_0x5861b3<_0x4b2a4a[_0x17bf('0x7')];_0x5861b3+=0x1){_0xaa2550=_0x4b2a4a[_0x5861b3];if(_[_0x17bf('0x8')](_0x198a6d[_0x17bf('0x6')][_0xaa2550['id']])){_0x198a6d[_0x17bf('0x6')][_0xaa2550['id']]=new MailAccount(_0xaa2550);}else{_[_0x17bf('0x9')](_0x198a6d['mailAccounts'][_0xaa2550['id']],_0xaa2550);}}}return _0x198a6d[_0x17bf('0x6')];};};module[_0x17bf('0xa')]=Realtime;