Built motion from commit 0c5f406c.|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 _0x72be=['Email\x20service\x20initialization','./server','./lib/email','./rpc/setting','../../config/logger','email','resolve','then','getMailAccounts','initMailAccounts','listen','getSettings','loginMailFrequency','catch','error'];(function(_0x36fe63,_0x13af61){var _0x33841c=function(_0x343e62){while(--_0x343e62){_0x36fe63['push'](_0x36fe63['shift']());}};_0x33841c(++_0x13af61);}(_0x72be,0xd3));var _0xe72b=function(_0x1e921d,_0x40b492){_0x1e921d=_0x1e921d-0x0;var _0x216006=_0x72be[_0x1e921d];return _0x216006;};'use strict';var server=require(_0xe72b('0x0'));var Realtime=require('./realtime');var EmailChannel=require(_0xe72b('0x1'));var mailAccount=require('./rpc/mailAccount');var setting=require(_0xe72b('0x2'));var logger=require(_0xe72b('0x3'))(_0xe72b('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xe72b('0x5')]()[_0xe72b('0x6')](mailAccount[_0xe72b('0x7')]())[_0xe72b('0x6')](realtime[_0xe72b('0x8')]())[_0xe72b('0x6')](function(){email['refresh'](realtime['mailAccounts']);return realtime;});}function main(){return server[_0xe72b('0x9')](realtime,email)[_0xe72b('0x6')](function(){return initRealtime();})['then'](function(){return setting[_0xe72b('0xa')]();})['then'](function(_0x43b45a){return setInterval(initRealtime,_0x43b45a[_0xe72b('0xb')]*0x3e8);})[_0xe72b('0xc')](function(_0x25104a){logger[_0xe72b('0xd')](_0xe72b('0xe'),_0x25104a);});}main();