1 // *************************************************************************
3 // * xCALLY Motion - The Omnichannel Contact Center *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved *
6 // *************************************************************************
8 // * Email: info@xcally.com *
9 // * Website: https://www.xcally.com *
11 // *************************************************************************
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. *
17 // *************************************************************************
18 var _0x106f=['listen','loginMailFrequency','catch','log','bluebird','./server','./lib/email','./rpc/mailAccount','resolve','getMailAccounts','then','initMailAccounts','refresh','mailAccounts'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x106f,0x162));var _0xf106=function(_0x3048c3,_0x1d3a89){_0x3048c3=_0x3048c3-0x0;var _0x50c580=_0x106f[_0x3048c3];return _0x50c580;};'use strict';var BPromise=require(_0xf106('0x0'));var server=require(_0xf106('0x1'));var Realtime=require('./realtime');var EmailChannel=require(_0xf106('0x2'));var mailAccount=require(_0xf106('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require('../../mysqldb')['db'];function initRealtime(){return BPromise[_0xf106('0x4')]()['then'](mailAccount[_0xf106('0x5')]())[_0xf106('0x6')](realtime[_0xf106('0x7')]())[_0xf106('0x6')](function(){email[_0xf106('0x8')](realtime[_0xf106('0x9')]);return realtime;});}function main(){return server[_0xf106('0xa')](realtime,email)['then'](function(_0x4ea3b8){return initRealtime();})[_0xf106('0x6')](function(_0x5ea4f0){return db['Setting']['findOne']({'attributes':['id','loginMailFrequency'],'raw':!![]});})['then'](function(_0x3dc01d){return setInterval(initRealtime,_0x3dc01d[_0xf106('0xb')]*0x3e8);})[_0xf106('0xc')](function(_0x454d07){console[_0xf106('0xd')](_0x454d07);});}main();