Built motion from commit 9d7072cc.|2.5.39
[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 _0x129f=['./rpc/setting','resolve','then','getMailAccounts','initMailAccounts','refresh','mailAccounts','listen','loginMailFrequency','catch','log','bluebird','./lib/email','./rpc/mailAccount'];(function(_0xb89931,_0x461b9e){var _0x324b86=function(_0x4be23d){while(--_0x4be23d){_0xb89931['push'](_0xb89931['shift']());}};_0x324b86(++_0x461b9e);}(_0x129f,0x13f));var _0xf129=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x129f[_0x5f1391];return _0x50ebe3;};'use strict';var BPromise=require(_0xf129('0x0'));var server=require('./server');var Realtime=require('./realtime');var EmailChannel=require(_0xf129('0x1'));var mailAccount=require(_0xf129('0x2'));var setting=require(_0xf129('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0xf129('0x4')]()[_0xf129('0x5')](mailAccount[_0xf129('0x6')]())[_0xf129('0x5')](realtime[_0xf129('0x7')]())['then'](function(){email[_0xf129('0x8')](realtime[_0xf129('0x9')]);return realtime;});}function main(){return server[_0xf129('0xa')](realtime,email)[_0xf129('0x5')](function(){return initRealtime();})['then'](function(){return setting['getSettings']();})[_0xf129('0x5')](function(_0x5bcd7d){return setInterval(initRealtime,_0x5bcd7d[_0xf129('0xb')]*0x3e8);})[_0xf129('0xc')](function(_0x31f877){console[_0xf129('0xd')](_0x31f877);});}main();