Built motion from commit f7863d46.|2.5.41
[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 _0xf4cb=['getMailAccounts','initMailAccounts','refresh','mailAccounts','getSettings','loginMailFrequency','error','Email\x20service\x20initialization','./server','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','resolve','then'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf4cb,0xa8));var _0xbf4c=function(_0x5bbc0b,_0x72df5a){_0x5bbc0b=_0x5bbc0b-0x0;var _0x2a41f5=_0xf4cb[_0x5bbc0b];return _0x2a41f5;};'use strict';var server=require(_0xbf4c('0x0'));var Realtime=require(_0xbf4c('0x1'));var EmailChannel=require(_0xbf4c('0x2'));var mailAccount=require(_0xbf4c('0x3'));var setting=require(_0xbf4c('0x4'));var logger=require(_0xbf4c('0x5'))('email');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xbf4c('0x6')]()[_0xbf4c('0x7')](mailAccount[_0xbf4c('0x8')]())[_0xbf4c('0x7')](realtime[_0xbf4c('0x9')]())[_0xbf4c('0x7')](function(){email[_0xbf4c('0xa')](realtime[_0xbf4c('0xb')]);return realtime;});}function main(){return server['listen'](realtime,email)[_0xbf4c('0x7')](function(){return initRealtime();})['then'](function(){return setting[_0xbf4c('0xc')]();})['then'](function(_0xb105d5){return setInterval(initRealtime,_0xb105d5[_0xbf4c('0xd')]*0x3e8);})['catch'](function(_0x5e444d){logger[_0xbf4c('0xe')](_0xbf4c('0xf'),_0x5e444d);});}main();