Built motion from commit 449495f6.|2.6.27
[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 _0xef89=['./rpc/setting','../../config/logger','then','initMailAccounts','refresh','getSettings','loginMailFrequency','catch','error','./server','./realtime','./lib/email','./rpc/mailAccount'];(function(_0x5b2529,_0x40015f){var _0x37538c=function(_0x592a94){while(--_0x592a94){_0x5b2529['push'](_0x5b2529['shift']());}};_0x37538c(++_0x40015f);}(_0xef89,0xf3));var _0x9ef8=function(_0x40aaea,_0x3f4db7){_0x40aaea=_0x40aaea-0x0;var _0x3bac0f=_0xef89[_0x40aaea];return _0x3bac0f;};'use strict';var server=require(_0x9ef8('0x0'));var Realtime=require(_0x9ef8('0x1'));var EmailChannel=require(_0x9ef8('0x2'));var mailAccount=require(_0x9ef8('0x3'));var setting=require(_0x9ef8('0x4'));var logger=require(_0x9ef8('0x5'))('email');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise['resolve']()[_0x9ef8('0x6')](mailAccount['getMailAccounts']())[_0x9ef8('0x6')](realtime[_0x9ef8('0x7')]())[_0x9ef8('0x6')](function(){email[_0x9ef8('0x8')](realtime['mailAccounts']);return realtime;});}function main(){return server['listen'](realtime,email)['then'](function(){return initRealtime();})[_0x9ef8('0x6')](function(){return setting[_0x9ef8('0x9')]();})[_0x9ef8('0x6')](function(_0x409e9a){return setInterval(initRealtime,_0x409e9a[_0x9ef8('0xa')]*0x3e8);})[_0x9ef8('0xb')](function(_0x2a75d9){logger[_0x9ef8('0xc')]('Email\x20service\x20initialization',_0x2a75d9);});}main();