Built motion from commit 1cfc41f6.|2.5.41
[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 _0x11f9=['getSettings','loginMailFrequency','catch','error','Email\x20service\x20initialization','./server','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','resolve','then','getMailAccounts','initMailAccounts','refresh','mailAccounts'];(function(_0x270497,_0x2ba171){var _0x304dcc=function(_0x5dc5b1){while(--_0x5dc5b1){_0x270497['push'](_0x270497['shift']());}};_0x304dcc(++_0x2ba171);}(_0x11f9,0x75));var _0x911f=function(_0x549b21,_0x3bfe06){_0x549b21=_0x549b21-0x0;var _0x2d025a=_0x11f9[_0x549b21];return _0x2d025a;};'use strict';var server=require(_0x911f('0x0'));var Realtime=require('./realtime');var EmailChannel=require(_0x911f('0x1'));var mailAccount=require(_0x911f('0x2'));var setting=require(_0x911f('0x3'));var logger=require(_0x911f('0x4'))('email');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x911f('0x5')]()[_0x911f('0x6')](mailAccount[_0x911f('0x7')]())[_0x911f('0x6')](realtime[_0x911f('0x8')]())['then'](function(){email[_0x911f('0x9')](realtime[_0x911f('0xa')]);return realtime;});}function main(){return server['listen'](realtime,email)[_0x911f('0x6')](function(){return initRealtime();})[_0x911f('0x6')](function(){return setting[_0x911f('0xb')]();})[_0x911f('0x6')](function(_0x2ce02a){return setInterval(initRealtime,_0x2ce02a[_0x911f('0xc')]*0x3e8);})[_0x911f('0xd')](function(_0x2b02b9){logger[_0x911f('0xe')](_0x911f('0xf'),_0x2b02b9);});}main();