f0cc2008530ea1868cf00b2531c7ecc59431b080
[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 _0x6fb6=['./server','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','email','resolve','then','getMailAccounts','refresh','mailAccounts','listen','getSettings','loginMailFrequency','catch','error','Email\x20service\x20initialization'];(function(_0x53b67d,_0x251707){var _0xff73e7=function(_0x5bafe4){while(--_0x5bafe4){_0x53b67d['push'](_0x53b67d['shift']());}};_0xff73e7(++_0x251707);}(_0x6fb6,0x77));var _0x66fb=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x6fb6[_0x501510];return _0x1e6ee5;};'use strict';var server=require(_0x66fb('0x0'));var Realtime=require(_0x66fb('0x1'));var EmailChannel=require(_0x66fb('0x2'));var mailAccount=require(_0x66fb('0x3'));var setting=require(_0x66fb('0x4'));var logger=require('../../config/logger')(_0x66fb('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x66fb('0x6')]()[_0x66fb('0x7')](mailAccount[_0x66fb('0x8')]())[_0x66fb('0x7')](realtime['initMailAccounts']())[_0x66fb('0x7')](function(){email[_0x66fb('0x9')](realtime[_0x66fb('0xa')]);return realtime;});}function main(){return server[_0x66fb('0xb')](realtime,email)[_0x66fb('0x7')](function(){return initRealtime();})['then'](function(){return setting[_0x66fb('0xc')]();})['then'](function(_0x5e52fb){return setInterval(initRealtime,_0x5e52fb[_0x66fb('0xd')]*0x3e8);})[_0x66fb('0xe')](function(_0x5ec876){logger[_0x66fb('0xf')](_0x66fb('0x10'),_0x5ec876);});}main();