Built motion from commit fe909640.|2.6.8
[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 _0xdd73=['../../config/logger','email','then','refresh','mailAccounts','listen','loginMailFrequency','catch','error','Email\x20service\x20initialization','./realtime','./lib/email','./rpc/setting'];(function(_0x56b2ef,_0x41180c){var _0x1cf259=function(_0x43a1a2){while(--_0x43a1a2){_0x56b2ef['push'](_0x56b2ef['shift']());}};_0x1cf259(++_0x41180c);}(_0xdd73,0x15c));var _0x3dd7=function(_0xc051b2,_0x3d6d9d){_0xc051b2=_0xc051b2-0x0;var _0x599dc2=_0xdd73[_0xc051b2];return _0x599dc2;};'use strict';var server=require('./server');var Realtime=require(_0x3dd7('0x0'));var EmailChannel=require(_0x3dd7('0x1'));var mailAccount=require('./rpc/mailAccount');var setting=require(_0x3dd7('0x2'));var logger=require(_0x3dd7('0x3'))(_0x3dd7('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise['resolve']()[_0x3dd7('0x5')](mailAccount['getMailAccounts']())['then'](realtime['initMailAccounts']())[_0x3dd7('0x5')](function(){email[_0x3dd7('0x6')](realtime[_0x3dd7('0x7')]);return realtime;});}function main(){return server[_0x3dd7('0x8')](realtime,email)[_0x3dd7('0x5')](function(){return initRealtime();})['then'](function(){return setting['getSettings']();})[_0x3dd7('0x5')](function(_0x36c5f8){return setInterval(initRealtime,_0x36c5f8[_0x3dd7('0x9')]*0x3e8);})[_0x3dd7('0xa')](function(_0x1cc8d7){logger[_0x3dd7('0xb')](_0x3dd7('0xc'),_0x1cc8d7);});}main();