Built motion from commit 3c2ce842.|2.6.31
[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 _0x7c07=['catch','error','Email\x20service\x20initialization','./server','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','email','getMailAccounts','then','initMailAccounts','listen','getSettings','loginMailFrequency'];(function(_0x1f4e75,_0x2520a1){var _0x31103a=function(_0x2352fe){while(--_0x2352fe){_0x1f4e75['push'](_0x1f4e75['shift']());}};_0x31103a(++_0x2520a1);}(_0x7c07,0xd5));var _0x77c0=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0x7c07[_0xf0bcac];return _0x4e4c65;};'use strict';var server=require(_0x77c0('0x0'));var Realtime=require(_0x77c0('0x1'));var EmailChannel=require(_0x77c0('0x2'));var mailAccount=require(_0x77c0('0x3'));var setting=require(_0x77c0('0x4'));var logger=require('../../config/logger')(_0x77c0('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise['resolve']()['then'](mailAccount[_0x77c0('0x6')]())[_0x77c0('0x7')](realtime[_0x77c0('0x8')]())[_0x77c0('0x7')](function(){email['refresh'](realtime['mailAccounts']);return realtime;});}function main(){return server[_0x77c0('0x9')](realtime,email)[_0x77c0('0x7')](function(){return initRealtime();})['then'](function(){return setting[_0x77c0('0xa')]();})[_0x77c0('0x7')](function(_0x25e195){return setInterval(initRealtime,_0x25e195[_0x77c0('0xb')]*0x3e8);})[_0x77c0('0xc')](function(_0x4dd8d7){logger[_0x77c0('0xd')](_0x77c0('0xe'),_0x4dd8d7);});}main();