4a407ef214a787c951279aa49a3d6f2c971deab9
[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 _0xf382=['initMailAccounts','refresh','listen','getSettings','loginMailFrequency','error','Email\x20service\x20initialization','./realtime','./lib/email','./rpc/setting','../../config/logger','email','resolve','then','getMailAccounts'];(function(_0x8e322a,_0x2bab7d){var _0x4b604f=function(_0x46bba7){while(--_0x46bba7){_0x8e322a['push'](_0x8e322a['shift']());}};_0x4b604f(++_0x2bab7d);}(_0xf382,0xbb));var _0x2f38=function(_0xa0f369,_0x33b6ca){_0xa0f369=_0xa0f369-0x0;var _0x4efacc=_0xf382[_0xa0f369];return _0x4efacc;};'use strict';var server=require('./server');var Realtime=require(_0x2f38('0x0'));var EmailChannel=require(_0x2f38('0x1'));var mailAccount=require('./rpc/mailAccount');var setting=require(_0x2f38('0x2'));var logger=require(_0x2f38('0x3'))(_0x2f38('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x2f38('0x5')]()[_0x2f38('0x6')](mailAccount[_0x2f38('0x7')]())[_0x2f38('0x6')](realtime[_0x2f38('0x8')]())[_0x2f38('0x6')](function(){email[_0x2f38('0x9')](realtime['mailAccounts']);return realtime;});}function main(){return server[_0x2f38('0xa')](realtime,email)[_0x2f38('0x6')](function(){return initRealtime();})[_0x2f38('0x6')](function(){return setting[_0x2f38('0xb')]();})[_0x2f38('0x6')](function(_0x55040f){return setInterval(initRealtime,_0x55040f[_0x2f38('0xc')]*0x3e8);})['catch'](function(_0x2ff350){logger[_0x2f38('0xd')](_0x2f38('0xe'),_0x2ff350);});}main();