Built motion from commit 3d3e98f2.|2.6.29
[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 _0xb718=['./rpc/mailAccount','./rpc/setting','email','then','initMailAccounts','refresh','mailAccounts','listen','catch','Email\x20service\x20initialization','./server','./realtime','./lib/email'];(function(_0x16fb2a,_0x117a5d){var _0x4c5c29=function(_0x52ef01){while(--_0x52ef01){_0x16fb2a['push'](_0x16fb2a['shift']());}};_0x4c5c29(++_0x117a5d);}(_0xb718,0xda));var _0x8b71=function(_0xec359a,_0x5981db){_0xec359a=_0xec359a-0x0;var _0x49b5b8=_0xb718[_0xec359a];return _0x49b5b8;};'use strict';var server=require(_0x8b71('0x0'));var Realtime=require(_0x8b71('0x1'));var EmailChannel=require(_0x8b71('0x2'));var mailAccount=require(_0x8b71('0x3'));var setting=require(_0x8b71('0x4'));var logger=require('../../config/logger')(_0x8b71('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise['resolve']()['then'](mailAccount['getMailAccounts']())[_0x8b71('0x6')](realtime[_0x8b71('0x7')]())[_0x8b71('0x6')](function(){email[_0x8b71('0x8')](realtime[_0x8b71('0x9')]);return realtime;});}function main(){return server[_0x8b71('0xa')](realtime,email)[_0x8b71('0x6')](function(){return initRealtime();})[_0x8b71('0x6')](function(){return setting['getSettings']();})['then'](function(_0x544d2a){return setInterval(initRealtime,_0x544d2a['loginMailFrequency']*0x3e8);})[_0x8b71('0xb')](function(_0x5c1bef){logger['error'](_0x8b71('0xc'),_0x5c1bef);});}main();