77992b20d7bf16791d6baeb13c332dafb8dbfd73
[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 _0xc7b6=['./lib/email','./rpc/mailAccount','../../config/logger','email','resolve','then','initMailAccounts','mailAccounts','listen','getSettings','loginMailFrequency','catch','error','Email\x20service\x20initialization'];(function(_0x34c26b,_0x5e279b){var _0x2f9f58=function(_0x273abe){while(--_0x273abe){_0x34c26b['push'](_0x34c26b['shift']());}};_0x2f9f58(++_0x5e279b);}(_0xc7b6,0x15e));var _0x6c7b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc7b6[_0x321bb2];return _0x9c12ed;};'use strict';var server=require('./server');var Realtime=require('./realtime');var EmailChannel=require(_0x6c7b('0x0'));var mailAccount=require(_0x6c7b('0x1'));var setting=require('./rpc/setting');var logger=require(_0x6c7b('0x2'))(_0x6c7b('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x6c7b('0x4')]()[_0x6c7b('0x5')](mailAccount['getMailAccounts']())[_0x6c7b('0x5')](realtime[_0x6c7b('0x6')]())[_0x6c7b('0x5')](function(){email['refresh'](realtime[_0x6c7b('0x7')]);return realtime;});}function main(){return server[_0x6c7b('0x8')](realtime,email)[_0x6c7b('0x5')](function(){return initRealtime();})[_0x6c7b('0x5')](function(){return setting[_0x6c7b('0x9')]();})[_0x6c7b('0x5')](function(_0x52c649){return setInterval(initRealtime,_0x52c649[_0x6c7b('0xa')]*0x3e8);})[_0x6c7b('0xb')](function(_0x47f2b6){logger[_0x6c7b('0xc')](_0x6c7b('0xd'),_0x47f2b6);});}main();