Built motion from commit 21186556.|2.6.19
[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 _0xf206=['initMailAccounts','refresh','mailAccounts','listen','getSettings','loginMailFrequency','catch','error','Email\x20service\x20initialization','./server','./rpc/mailAccount','./rpc/setting','../../config/logger','email','then','getMailAccounts'];(function(_0x3c84f2,_0x44619e){var _0x3fb9aa=function(_0x32e52c){while(--_0x32e52c){_0x3c84f2['push'](_0x3c84f2['shift']());}};_0x3fb9aa(++_0x44619e);}(_0xf206,0x109));var _0x6f20=function(_0x27bf3c,_0x1e416a){_0x27bf3c=_0x27bf3c-0x0;var _0x15b8b3=_0xf206[_0x27bf3c];return _0x15b8b3;};'use strict';var server=require(_0x6f20('0x0'));var Realtime=require('./realtime');var EmailChannel=require('./lib/email');var mailAccount=require(_0x6f20('0x1'));var setting=require(_0x6f20('0x2'));var logger=require(_0x6f20('0x3'))(_0x6f20('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise['resolve']()[_0x6f20('0x5')](mailAccount[_0x6f20('0x6')]())[_0x6f20('0x5')](realtime[_0x6f20('0x7')]())[_0x6f20('0x5')](function(){email[_0x6f20('0x8')](realtime[_0x6f20('0x9')]);return realtime;});}function main(){return server[_0x6f20('0xa')](realtime,email)[_0x6f20('0x5')](function(){return initRealtime();})['then'](function(){return setting[_0x6f20('0xb')]();})['then'](function(_0x3e17b0){return setInterval(initRealtime,_0x3e17b0[_0x6f20('0xc')]*0x3e8);})[_0x6f20('0xd')](function(_0x3706e5){logger[_0x6f20('0xe')](_0x6f20('0xf'),_0x3706e5);});}main();