b5da0d3ace96cabc854c53d6afd1ea39ae4f2227
[motion2.git] / server / services / email / 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 _0x98c5=['email','resolve','then','getMailAccounts','initMailAccounts','refresh','listen','getSettings','catch','error','Email\x20service\x20initialization','./server','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x98c5,0xfb));var _0x598c=function(_0x5a1b4,_0x293ba3){_0x5a1b4=_0x5a1b4-0x0;var _0x41a7f7=_0x98c5[_0x5a1b4];return _0x41a7f7;};'use strict';var server=require(_0x598c('0x0'));var Realtime=require(_0x598c('0x1'));var EmailChannel=require(_0x598c('0x2'));var mailAccount=require(_0x598c('0x3'));var setting=require(_0x598c('0x4'));var logger=require('../../config/logger')(_0x598c('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x598c('0x6')]()[_0x598c('0x7')](mailAccount[_0x598c('0x8')]())['then'](realtime[_0x598c('0x9')]())[_0x598c('0x7')](function(){email[_0x598c('0xa')](realtime['mailAccounts']);return realtime;});}function main(){return server[_0x598c('0xb')](realtime,email)['then'](function(){return initRealtime();})['then'](function(){return setting[_0x598c('0xc')]();})[_0x598c('0x7')](function(_0x57b3de){return setInterval(initRealtime,_0x57b3de['loginMailFrequency']*0x3e8);})[_0x598c('0xd')](function(_0x5dc4d5){logger[_0x598c('0xe')](_0x598c('0xf'),_0x5dc4d5);});}main();