Built motion from commit c738b9ac.|2.6.25
[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 _0xfcb2=['mergeFromDatabase','initMailAccounts','length','isUndefined','merge','exports','mailAccounts','mapKeys','hasOwnProperty','prototype'];(function(_0xbebe13,_0x2974a3){var _0x230505=function(_0x45e8c6){while(--_0x45e8c6){_0xbebe13['push'](_0xbebe13['shift']());}};_0x230505(++_0x2974a3);}(_0xfcb2,0x1d2));var _0x2fcb=function(_0x3c3a12,_0x164bc3){_0x3c3a12=_0x3c3a12-0x0;var _0xad13e5=_0xfcb2[_0x3c3a12];return _0xad13e5;};'use strict';var _=require('lodash');var MailAccount=require('../model/mailAccount');var Realtime=function(){this[_0x2fcb('0x0')]={};};function freeIsNotKey(_0x5d8f17,_0x2f5bff,_0x1a6e2e){var _0x56fd96=_[_0x2fcb('0x1')](_0x5d8f17,function(_0x2cc864,_0x265af1){return _0x2cc864[_0x1a6e2e];});for(var _0x46e445 in _0x2f5bff){if(_0x2f5bff[_0x2fcb('0x2')](_0x46e445)){if(!_0x56fd96[_0x46e445]){delete _0x2f5bff[_0x46e445];}}}}Realtime[_0x2fcb('0x3')][_0x2fcb('0x4')]=function(_0x29668f,_0x4693b0){for(var _0x1fbfed in _0x4693b0){if(_0x29668f[_0x2fcb('0x2')](_0x1fbfed)){_0x29668f[_0x1fbfed]=_0x4693b0[_0x1fbfed];}}};Realtime[_0x2fcb('0x3')][_0x2fcb('0x5')]=function(){var _0x54d7e2=this;return function(_0x3464e2){if(_0x3464e2){freeIsNotKey(_0x3464e2,_0x54d7e2[_0x2fcb('0x0')],'id');for(var _0xae8a83=0x0,_0x1c3e02={},_0x6fec07={};_0xae8a83<_0x3464e2[_0x2fcb('0x6')];_0xae8a83+=0x1){_0x1c3e02=_0x3464e2[_0xae8a83];if(_[_0x2fcb('0x7')](_0x54d7e2['mailAccounts'][_0x1c3e02['id']])){_0x54d7e2['mailAccounts'][_0x1c3e02['id']]=new MailAccount(_0x1c3e02);}else{_[_0x2fcb('0x8')](_0x54d7e2[_0x2fcb('0x0')][_0x1c3e02['id']],_0x1c3e02);}}}return _0x54d7e2[_0x2fcb('0x0')];};};module[_0x2fcb('0x9')]=Realtime;