Built motion from commit 52c8a02d.|2.6.29
[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 _0x03f4=['Email\x20service\x20initialization','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','email','resolve','then','getMailAccounts','initMailAccounts','listen','getSettings','catch','error'];(function(_0x41dd46,_0xad1db6){var _0xe58d94=function(_0x28eb34){while(--_0x28eb34){_0x41dd46['push'](_0x41dd46['shift']());}};_0xe58d94(++_0xad1db6);}(_0x03f4,0xf1));var _0x403f=function(_0x26b249,_0x270ab0){_0x26b249=_0x26b249-0x0;var _0x512258=_0x03f4[_0x26b249];return _0x512258;};'use strict';var server=require('./server');var Realtime=require(_0x403f('0x0'));var EmailChannel=require(_0x403f('0x1'));var mailAccount=require(_0x403f('0x2'));var setting=require(_0x403f('0x3'));var logger=require(_0x403f('0x4'))(_0x403f('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x403f('0x6')]()[_0x403f('0x7')](mailAccount[_0x403f('0x8')]())[_0x403f('0x7')](realtime[_0x403f('0x9')]())['then'](function(){email['refresh'](realtime['mailAccounts']);return realtime;});}function main(){return server[_0x403f('0xa')](realtime,email)[_0x403f('0x7')](function(){return initRealtime();})[_0x403f('0x7')](function(){return setting[_0x403f('0xb')]();})['then'](function(_0x4b2ed1){return setInterval(initRealtime,_0x4b2ed1['loginMailFrequency']*0x3e8);})[_0x403f('0xc')](function(_0x36cbe8){logger[_0x403f('0xd')](_0x403f('0xe'),_0x36cbe8);});}main();