Built motion from commit 10af8726.|2.6.34
[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 _0xd7c6=['./lib/email','./rpc/mailAccount','./rpc/setting','email','resolve','then','getMailAccounts','initMailAccounts','refresh','mailAccounts','listen','getSettings','loginMailFrequency','catch','./server','./realtime'];(function(_0x28d18d,_0x55896b){var _0x470640=function(_0x57e78b){while(--_0x57e78b){_0x28d18d['push'](_0x28d18d['shift']());}};_0x470640(++_0x55896b);}(_0xd7c6,0x17e));var _0x6d7c=function(_0x3e64c5,_0x3ac2d5){_0x3e64c5=_0x3e64c5-0x0;var _0x7cae93=_0xd7c6[_0x3e64c5];return _0x7cae93;};'use strict';var server=require(_0x6d7c('0x0'));var Realtime=require(_0x6d7c('0x1'));var EmailChannel=require(_0x6d7c('0x2'));var mailAccount=require(_0x6d7c('0x3'));var setting=require(_0x6d7c('0x4'));var logger=require('../../config/logger')(_0x6d7c('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x6d7c('0x6')]()[_0x6d7c('0x7')](mailAccount[_0x6d7c('0x8')]())[_0x6d7c('0x7')](realtime[_0x6d7c('0x9')]())[_0x6d7c('0x7')](function(){email[_0x6d7c('0xa')](realtime[_0x6d7c('0xb')]);return realtime;});}function main(){return server[_0x6d7c('0xc')](realtime,email)[_0x6d7c('0x7')](function(){return initRealtime();})[_0x6d7c('0x7')](function(){return setting[_0x6d7c('0xd')]();})[_0x6d7c('0x7')](function(_0x45cdc0){return setInterval(initRealtime,_0x45cdc0[_0x6d7c('0xe')]*0x3e8);})[_0x6d7c('0xf')](function(_0x456527){logger['error']('Email\x20service\x20initialization',_0x456527);});}main();