Built motion from commit 85328c08.|2.5.50
[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 _0x1142=['catch','error','Email\x20service\x20initialization','./server','./rpc/setting','email','resolve','getMailAccounts','initMailAccounts','then','refresh','mailAccounts','listen','loginMailFrequency'];(function(_0xbeb808,_0x881ddf){var _0x5d6909=function(_0x37d652){while(--_0x37d652){_0xbeb808['push'](_0xbeb808['shift']());}};_0x5d6909(++_0x881ddf);}(_0x1142,0x153));var _0x2114=function(_0xe5ba98,_0x1065e5){_0xe5ba98=_0xe5ba98-0x0;var _0x4a4704=_0x1142[_0xe5ba98];return _0x4a4704;};'use strict';var server=require(_0x2114('0x0'));var Realtime=require('./realtime');var EmailChannel=require('./lib/email');var mailAccount=require('./rpc/mailAccount');var setting=require(_0x2114('0x1'));var logger=require('../../config/logger')(_0x2114('0x2'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x2114('0x3')]()['then'](mailAccount[_0x2114('0x4')]())['then'](realtime[_0x2114('0x5')]())[_0x2114('0x6')](function(){email[_0x2114('0x7')](realtime[_0x2114('0x8')]);return realtime;});}function main(){return server[_0x2114('0x9')](realtime,email)[_0x2114('0x6')](function(){return initRealtime();})['then'](function(){return setting['getSettings']();})[_0x2114('0x6')](function(_0x5a1f8c){return setInterval(initRealtime,_0x5a1f8c[_0x2114('0xa')]*0x3e8);})[_0x2114('0xb')](function(_0xe63f4c){logger[_0x2114('0xc')](_0x2114('0xd'),_0xe63f4c);});}main();