Built motion from commit 497d3d92.|2.5.43
[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 _0x9da1=['loginMailFrequency','catch','error','Email\x20service\x20initialization','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','email','then','getMailAccounts','initMailAccounts','refresh','listen'];(function(_0x3b3887,_0xfcbb87){var _0x5446d7=function(_0x399b48){while(--_0x399b48){_0x3b3887['push'](_0x3b3887['shift']());}};_0x5446d7(++_0xfcbb87);}(_0x9da1,0xb8));var _0x19da=function(_0x52ecb7,_0x3b7be9){_0x52ecb7=_0x52ecb7-0x0;var _0x81156c=_0x9da1[_0x52ecb7];return _0x81156c;};'use strict';var server=require('./server');var Realtime=require(_0x19da('0x0'));var EmailChannel=require(_0x19da('0x1'));var mailAccount=require(_0x19da('0x2'));var setting=require(_0x19da('0x3'));var logger=require(_0x19da('0x4'))(_0x19da('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise['resolve']()[_0x19da('0x6')](mailAccount[_0x19da('0x7')]())['then'](realtime[_0x19da('0x8')]())['then'](function(){email[_0x19da('0x9')](realtime['mailAccounts']);return realtime;});}function main(){return server[_0x19da('0xa')](realtime,email)[_0x19da('0x6')](function(){return initRealtime();})[_0x19da('0x6')](function(){return setting['getSettings']();})[_0x19da('0x6')](function(_0x1f55a3){return setInterval(initRealtime,_0x1f55a3[_0x19da('0xb')]*0x3e8);})[_0x19da('0xc')](function(_0x38570f){logger[_0x19da('0xd')](_0x19da('0xe'),_0x38570f);});}main();