1 // *************************************************************************
3 // * xCALLY Motion - The Omnichannel Contact Center *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved *
6 // *************************************************************************
8 // * Email: info@xcally.com *
9 // * Website: https://www.xcally.com *
11 // *************************************************************************
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. *
17 // *************************************************************************
18 var _0x50b6=['then','mailAccounts','listen','getSettings','loginMailFrequency','catch','Email\x20service\x20initialization','./server','./lib/email','./rpc/mailAccount','./rpc/setting','email','resolve','getMailAccounts'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x50b6,0x1ab));var _0x650b=function(_0x446acb,_0x9dcc0e){_0x446acb=_0x446acb-0x0;var _0x3ce42f=_0x50b6[_0x446acb];return _0x3ce42f;};'use strict';var server=require(_0x650b('0x0'));var Realtime=require('./realtime');var EmailChannel=require(_0x650b('0x1'));var mailAccount=require(_0x650b('0x2'));var setting=require(_0x650b('0x3'));var logger=require('../../config/logger')(_0x650b('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x650b('0x5')]()['then'](mailAccount[_0x650b('0x6')]())[_0x650b('0x7')](realtime['initMailAccounts']())[_0x650b('0x7')](function(){email['refresh'](realtime[_0x650b('0x8')]);return realtime;});}function main(){return server[_0x650b('0x9')](realtime,email)[_0x650b('0x7')](function(){return initRealtime();})['then'](function(){return setting[_0x650b('0xa')]();})['then'](function(_0x1e9dc8){return setInterval(initRealtime,_0x1e9dc8[_0x650b('0xb')]*0x3e8);})[_0x650b('0xc')](function(_0x2d345a){logger['error'](_0x650b('0xd'),_0x2d345a);});}main();