cae206cb73ccb19a78c0d9ec342bea595aefe93e
[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 _0xe0bf=['bluebird','./server','./realtime','./lib/email','then','getMailAccounts','refresh','listen','loginMailFrequency','catch'];(function(_0xced1c2,_0x21556b){var _0xac7c63=function(_0x573e09){while(--_0x573e09){_0xced1c2['push'](_0xced1c2['shift']());}};_0xac7c63(++_0x21556b);}(_0xe0bf,0x168));var _0xfe0b=function(_0x43c317,_0x30773c){_0x43c317=_0x43c317-0x0;var _0x2d2c4b=_0xe0bf[_0x43c317];return _0x2d2c4b;};'use strict';var BPromise=require(_0xfe0b('0x0'));var server=require(_0xfe0b('0x1'));var Realtime=require(_0xfe0b('0x2'));var EmailChannel=require(_0xfe0b('0x3'));var mailAccount=require('./rpc/mailAccount');var setting=require('./rpc/setting');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise['resolve']()[_0xfe0b('0x4')](mailAccount[_0xfe0b('0x5')]())[_0xfe0b('0x4')](realtime['initMailAccounts']())[_0xfe0b('0x4')](function(){email[_0xfe0b('0x6')](realtime['mailAccounts']);return realtime;});}function main(){return server[_0xfe0b('0x7')](realtime,email)['then'](function(){return initRealtime();})[_0xfe0b('0x4')](function(){return setting['getSettings']();})[_0xfe0b('0x4')](function(_0x2cfccf){return setInterval(initRealtime,_0x2cfccf[_0xfe0b('0x8')]*0x3e8);})[_0xfe0b('0x9')](function(_0x42a653){console['log'](_0x42a653);});}main();