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 _0x1980=['loginMailFrequency','error','Email\x20service\x20initialization','./server','./realtime','./lib/email','resolve','getMailAccounts','then','refresh','mailAccounts','getSettings'];(function(_0x5220f6,_0xab25f){var _0x32c0e0=function(_0x4ad714){while(--_0x4ad714){_0x5220f6['push'](_0x5220f6['shift']());}};_0x32c0e0(++_0xab25f);}(_0x1980,0x6f));var _0x0198=function(_0x370bc1,_0x123c05){_0x370bc1=_0x370bc1-0x0;var _0x10a973=_0x1980[_0x370bc1];return _0x10a973;};'use strict';var server=require(_0x0198('0x0'));var Realtime=require(_0x0198('0x1'));var EmailChannel=require(_0x0198('0x2'));var mailAccount=require('./rpc/mailAccount');var setting=require('./rpc/setting');var logger=require('../../config/logger')('email');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x0198('0x3')]()['then'](mailAccount[_0x0198('0x4')]())[_0x0198('0x5')](realtime['initMailAccounts']())[_0x0198('0x5')](function(){email[_0x0198('0x6')](realtime[_0x0198('0x7')]);return realtime;});}function main(){return server['listen'](realtime,email)[_0x0198('0x5')](function(){return initRealtime();})[_0x0198('0x5')](function(){return setting[_0x0198('0x8')]();})[_0x0198('0x5')](function(_0x50e037){return setInterval(initRealtime,_0x50e037[_0x0198('0x9')]*0x3e8);})['catch'](function(_0x4122ae){logger[_0x0198('0xa')](_0x0198('0xb'),_0x4122ae);});}main();