Built motion from commit ddca4d0d.|2.5.47
[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 _0x0fd3=['./rpc/mailAccount','../../config/logger','email','resolve','then','getMailAccounts','initMailAccounts','refresh','mailAccounts','listen','getSettings','error','Email\x20service\x20initialization','./lib/email'];(function(_0xb6160,_0x206fdb){var _0xce706e=function(_0x581daa){while(--_0x581daa){_0xb6160['push'](_0xb6160['shift']());}};_0xce706e(++_0x206fdb);}(_0x0fd3,0x141));var _0x30fd=function(_0x34843e,_0x4c4224){_0x34843e=_0x34843e-0x0;var _0x598f7f=_0x0fd3[_0x34843e];return _0x598f7f;};'use strict';var server=require('./server');var Realtime=require('./realtime');var EmailChannel=require(_0x30fd('0x0'));var mailAccount=require(_0x30fd('0x1'));var setting=require('./rpc/setting');var logger=require(_0x30fd('0x2'))(_0x30fd('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x30fd('0x4')]()[_0x30fd('0x5')](mailAccount[_0x30fd('0x6')]())[_0x30fd('0x5')](realtime[_0x30fd('0x7')]())[_0x30fd('0x5')](function(){email[_0x30fd('0x8')](realtime[_0x30fd('0x9')]);return realtime;});}function main(){return server[_0x30fd('0xa')](realtime,email)[_0x30fd('0x5')](function(){return initRealtime();})[_0x30fd('0x5')](function(){return setting[_0x30fd('0xb')]();})[_0x30fd('0x5')](function(_0x61cc5){return setInterval(initRealtime,_0x61cc5['loginMailFrequency']*0x3e8);})['catch'](function(_0x1cf414){logger[_0x30fd('0xc')](_0x30fd('0xd'),_0x1cf414);});}main();