Built motion from commit (unavailable).|2.5.31
[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 _0x7afe=['initMailAccounts','length','isUndefined','exports','../model/mailAccount','mailAccounts','mapKeys','prototype','mergeFromDatabase','hasOwnProperty'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0x7afe,0xea));var _0xe7af=function(_0x28a03c,_0x123a4a){_0x28a03c=_0x28a03c-0x0;var _0x4bbb1e=_0x7afe[_0x28a03c];return _0x4bbb1e;};'use strict';var _=require('lodash');var MailAccount=require(_0xe7af('0x0'));var Realtime=function(){this[_0xe7af('0x1')]={};};function freeIsNotKey(_0x5c14fc,_0x37e9fa,_0x581f26){var _0x20f4de=_[_0xe7af('0x2')](_0x5c14fc,function(_0x4c48c4,_0x2ebe5b){return _0x4c48c4[_0x581f26];});for(var _0x4abd72 in _0x37e9fa){if(_0x37e9fa['hasOwnProperty'](_0x4abd72)){if(!_0x20f4de[_0x4abd72]){delete _0x37e9fa[_0x4abd72];}}}}Realtime[_0xe7af('0x3')][_0xe7af('0x4')]=function(_0x24ab81,_0x4fdcb5){for(var _0x1b421a in _0x4fdcb5){if(_0x24ab81[_0xe7af('0x5')](_0x1b421a)){_0x24ab81[_0x1b421a]=_0x4fdcb5[_0x1b421a];}}};Realtime[_0xe7af('0x3')][_0xe7af('0x6')]=function(){var _0x3c9bc5=this;return function(_0x55649a){if(_0x55649a){freeIsNotKey(_0x55649a,_0x3c9bc5[_0xe7af('0x1')],'id');for(var _0x195558=0x0,_0x367a66={},_0x4955fe={};_0x195558<_0x55649a[_0xe7af('0x7')];_0x195558+=0x1){_0x367a66=_0x55649a[_0x195558];if(_[_0xe7af('0x8')](_0x3c9bc5[_0xe7af('0x1')][_0x367a66['id']])){_0x3c9bc5[_0xe7af('0x1')][_0x367a66['id']]=new MailAccount(_0x367a66);}else{_['merge'](_0x3c9bc5['mailAccounts'][_0x367a66['id']],_0x367a66);}}}return _0x3c9bc5[_0xe7af('0x1')];};};module[_0xe7af('0x9')]=Realtime;