Built motion from commit 3770a7bd.|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 _0x73f7=['mailAccounts','listen','getSettings','Email\x20service\x20initialization','./server','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','resolve','then','refresh'];(function(_0x1832fd,_0x5236b8){var _0x1d5881=function(_0x49cd1a){while(--_0x49cd1a){_0x1832fd['push'](_0x1832fd['shift']());}};_0x1d5881(++_0x5236b8);}(_0x73f7,0xc7));var _0x773f=function(_0x3e4e8a,_0x5a190d){_0x3e4e8a=_0x3e4e8a-0x0;var _0x48f74b=_0x73f7[_0x3e4e8a];return _0x48f74b;};'use strict';var server=require(_0x773f('0x0'));var Realtime=require(_0x773f('0x1'));var EmailChannel=require(_0x773f('0x2'));var mailAccount=require(_0x773f('0x3'));var setting=require(_0x773f('0x4'));var logger=require(_0x773f('0x5'))('email');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x773f('0x6')]()['then'](mailAccount['getMailAccounts']())[_0x773f('0x7')](realtime['initMailAccounts']())[_0x773f('0x7')](function(){email[_0x773f('0x8')](realtime[_0x773f('0x9')]);return realtime;});}function main(){return server[_0x773f('0xa')](realtime,email)['then'](function(){return initRealtime();})[_0x773f('0x7')](function(){return setting[_0x773f('0xb')]();})[_0x773f('0x7')](function(_0x597b36){return setInterval(initRealtime,_0x597b36['loginMailFrequency']*0x3e8);})['catch'](function(_0x3b6623){logger['error'](_0x773f('0xc'),_0x3b6623);});}main();