Built motion from commit (unavailable).|2.5.30
[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 _0xef83=['resolve','then','refresh','getSettings','loginMailFrequency','log','bluebird','./server','./realtime','./lib/email'];(function(_0x4f251f,_0x507773){var _0x746297=function(_0x1504ce){while(--_0x1504ce){_0x4f251f['push'](_0x4f251f['shift']());}};_0x746297(++_0x507773);}(_0xef83,0x6a));var _0x3ef8=function(_0x309eb5,_0x36c7cf){_0x309eb5=_0x309eb5-0x0;var _0x1fa11e=_0xef83[_0x309eb5];return _0x1fa11e;};'use strict';var BPromise=require(_0x3ef8('0x0'));var server=require(_0x3ef8('0x1'));var Realtime=require(_0x3ef8('0x2'));var EmailChannel=require(_0x3ef8('0x3'));var mailAccount=require('./rpc/mailAccount');var setting=require('./rpc/setting');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0x3ef8('0x4')]()['then'](mailAccount['getMailAccounts']())[_0x3ef8('0x5')](realtime['initMailAccounts']())[_0x3ef8('0x5')](function(){email[_0x3ef8('0x6')](realtime['mailAccounts']);return realtime;});}function main(){return server['listen'](realtime,email)[_0x3ef8('0x5')](function(){return initRealtime();})[_0x3ef8('0x5')](function(){return setting[_0x3ef8('0x7')]();})[_0x3ef8('0x5')](function(_0x4314d5){return setInterval(initRealtime,_0x4314d5[_0x3ef8('0x8')]*0x3e8);})['catch'](function(_0x316235){console[_0x3ef8('0x9')](_0x316235);});}main();