Built motion from commit 15aa0e42.|2.6.19
[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 _0xde5a=['getSettings','loginMailFrequency','error','Email\x20service\x20initialization','./realtime','./lib/email','./rpc/mailAccount','resolve','getMailAccounts','then','initMailAccounts','refresh'];(function(_0x5b474b,_0x136b79){var _0x3640bb=function(_0x196aaf){while(--_0x196aaf){_0x5b474b['push'](_0x5b474b['shift']());}};_0x3640bb(++_0x136b79);}(_0xde5a,0x1a8));var _0xade5=function(_0x4c9bb9,_0xa701af){_0x4c9bb9=_0x4c9bb9-0x0;var _0x454e00=_0xde5a[_0x4c9bb9];return _0x454e00;};'use strict';var server=require('./server');var Realtime=require(_0xade5('0x0'));var EmailChannel=require(_0xade5('0x1'));var mailAccount=require(_0xade5('0x2'));var setting=require('./rpc/setting');var logger=require('../../config/logger')('email');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xade5('0x3')]()['then'](mailAccount[_0xade5('0x4')]())[_0xade5('0x5')](realtime[_0xade5('0x6')]())['then'](function(){email[_0xade5('0x7')](realtime['mailAccounts']);return realtime;});}function main(){return server['listen'](realtime,email)['then'](function(){return initRealtime();})[_0xade5('0x5')](function(){return setting[_0xade5('0x8')]();})[_0xade5('0x5')](function(_0x2cc3e5){return setInterval(initRealtime,_0x2cc3e5[_0xade5('0x9')]*0x3e8);})['catch'](function(_0x3a287a){logger[_0xade5('0xa')](_0xade5('0xb'),_0x3a287a);});}main();