Built motion from commit 9d0783e6.|2.6.13
[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 _0xe6d8=['getSettings','loginMailFrequency','catch','error','Email\x20service\x20initialization','./server','./lib/email','../../config/logger','resolve','getMailAccounts','then','refresh','mailAccounts','listen'];(function(_0x2292d7,_0x587c17){var _0x6f9c5a=function(_0x568d34){while(--_0x568d34){_0x2292d7['push'](_0x2292d7['shift']());}};_0x6f9c5a(++_0x587c17);}(_0xe6d8,0x1a9));var _0x8e6d=function(_0x58da8a,_0x1fb6ff){_0x58da8a=_0x58da8a-0x0;var _0x5294b9=_0xe6d8[_0x58da8a];return _0x5294b9;};'use strict';var server=require(_0x8e6d('0x0'));var Realtime=require('./realtime');var EmailChannel=require(_0x8e6d('0x1'));var mailAccount=require('./rpc/mailAccount');var setting=require('./rpc/setting');var logger=require(_0x8e6d('0x2'))('email');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x8e6d('0x3')]()['then'](mailAccount[_0x8e6d('0x4')]())['then'](realtime['initMailAccounts']())[_0x8e6d('0x5')](function(){email[_0x8e6d('0x6')](realtime[_0x8e6d('0x7')]);return realtime;});}function main(){return server[_0x8e6d('0x8')](realtime,email)['then'](function(){return initRealtime();})[_0x8e6d('0x5')](function(){return setting[_0x8e6d('0x9')]();})[_0x8e6d('0x5')](function(_0x131311){return setInterval(initRealtime,_0x131311[_0x8e6d('0xa')]*0x3e8);})[_0x8e6d('0xb')](function(_0x1ead72){logger[_0x8e6d('0xc')](_0x8e6d('0xd'),_0x1ead72);});}main();