Built motion from commit a61a4a20.|2.5.46
[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 _0x8a0e=['catch','error','Email\x20service\x20initialization','./server','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','email','resolve','getMailAccounts','then','initMailAccounts','refresh','listen','loginMailFrequency'];(function(_0x8e7703,_0x571749){var _0x10c54f=function(_0xc52c75){while(--_0xc52c75){_0x8e7703['push'](_0x8e7703['shift']());}};_0x10c54f(++_0x571749);}(_0x8a0e,0xd3));var _0xe8a0=function(_0x43b281,_0x3bdf11){_0x43b281=_0x43b281-0x0;var _0x557a7a=_0x8a0e[_0x43b281];return _0x557a7a;};'use strict';var server=require(_0xe8a0('0x0'));var Realtime=require(_0xe8a0('0x1'));var EmailChannel=require(_0xe8a0('0x2'));var mailAccount=require(_0xe8a0('0x3'));var setting=require(_0xe8a0('0x4'));var logger=require('../../config/logger')(_0xe8a0('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xe8a0('0x6')]()['then'](mailAccount[_0xe8a0('0x7')]())[_0xe8a0('0x8')](realtime[_0xe8a0('0x9')]())[_0xe8a0('0x8')](function(){email[_0xe8a0('0xa')](realtime['mailAccounts']);return realtime;});}function main(){return server[_0xe8a0('0xb')](realtime,email)[_0xe8a0('0x8')](function(){return initRealtime();})['then'](function(){return setting['getSettings']();})[_0xe8a0('0x8')](function(_0x24fbc1){return setInterval(initRealtime,_0x24fbc1[_0xe8a0('0xc')]*0x3e8);})[_0xe8a0('0xd')](function(_0xd6bd73){logger[_0xe8a0('0xe')](_0xe8a0('0xf'),_0xd6bd73);});}main();