6a5b2f9d2f29cdcf95138d40eb189cde962b502a
[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 _0x1827=['initMailAccounts','mailAccounts','listen','loginMailFrequency','error','Email\x20service\x20initialization','./realtime','./lib/email','./rpc/mailAccount','../../config/logger','email','then','getMailAccounts'];(function(_0x5429fd,_0x456b33){var _0x577643=function(_0x5922a2){while(--_0x5922a2){_0x5429fd['push'](_0x5429fd['shift']());}};_0x577643(++_0x456b33);}(_0x1827,0xbc));var _0x7182=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x1827[_0x1d1779];return _0x2377e9;};'use strict';var server=require('./server');var Realtime=require(_0x7182('0x0'));var EmailChannel=require(_0x7182('0x1'));var mailAccount=require(_0x7182('0x2'));var setting=require('./rpc/setting');var logger=require(_0x7182('0x3'))(_0x7182('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise['resolve']()[_0x7182('0x5')](mailAccount[_0x7182('0x6')]())[_0x7182('0x5')](realtime[_0x7182('0x7')]())['then'](function(){email['refresh'](realtime[_0x7182('0x8')]);return realtime;});}function main(){return server[_0x7182('0x9')](realtime,email)['then'](function(){return initRealtime();})[_0x7182('0x5')](function(){return setting['getSettings']();})[_0x7182('0x5')](function(_0x590311){return setInterval(initRealtime,_0x590311[_0x7182('0xa')]*0x3e8);})['catch'](function(_0x211efe){logger[_0x7182('0xb')](_0x7182('0xc'),_0x211efe);});}main();