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 _0xbbe4=['email','then','refresh','getSettings','loginMailFrequency','error','Email\x20service\x20initialization','./server','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting'];(function(_0x5198a7,_0x3ecd00){var _0x24dba6=function(_0x248669){while(--_0x248669){_0x5198a7['push'](_0x5198a7['shift']());}};_0x24dba6(++_0x3ecd00);}(_0xbbe4,0x13f));var _0x4bbe=function(_0x29a707,_0x342505){_0x29a707=_0x29a707-0x0;var _0x229e83=_0xbbe4[_0x29a707];return _0x229e83;};'use strict';var server=require(_0x4bbe('0x0'));var Realtime=require(_0x4bbe('0x1'));var EmailChannel=require(_0x4bbe('0x2'));var mailAccount=require(_0x4bbe('0x3'));var setting=require(_0x4bbe('0x4'));var logger=require('../../config/logger')(_0x4bbe('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise['resolve']()[_0x4bbe('0x6')](mailAccount['getMailAccounts']())[_0x4bbe('0x6')](realtime['initMailAccounts']())[_0x4bbe('0x6')](function(){email[_0x4bbe('0x7')](realtime['mailAccounts']);return realtime;});}function main(){return server['listen'](realtime,email)[_0x4bbe('0x6')](function(){return initRealtime();})['then'](function(){return setting[_0x4bbe('0x8')]();})[_0x4bbe('0x6')](function(_0x121605){return setInterval(initRealtime,_0x121605[_0x4bbe('0x9')]*0x3e8);})['catch'](function(_0x41028b){logger[_0x4bbe('0xa')](_0x4bbe('0xb'),_0x41028b);});}main();