Built motion from commit (unavailable).|2.5.9
[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 _0xf2ca=['./realtime','./rpc/mailAccount','../../mysqldb','resolve','then','getMailAccounts','refresh','mailAccounts','listen','Setting','loginMailFrequency','catch','bluebird','./server'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x343e70,_0xe5f373){_0x343e70=_0x343e70-0x0;var _0x2742fd=_0xf2ca[_0x343e70];return _0x2742fd;};'use strict';var BPromise=require(_0xaf2c('0x0'));var server=require(_0xaf2c('0x1'));var Realtime=require(_0xaf2c('0x2'));var EmailChannel=require('./lib/email');var mailAccount=require(_0xaf2c('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0xaf2c('0x4'))['db'];function initRealtime(){return BPromise[_0xaf2c('0x5')]()[_0xaf2c('0x6')](mailAccount[_0xaf2c('0x7')]())[_0xaf2c('0x6')](realtime['initMailAccounts']())[_0xaf2c('0x6')](function(){email[_0xaf2c('0x8')](realtime[_0xaf2c('0x9')]);return realtime;});}function main(){return server[_0xaf2c('0xa')](realtime,email)['then'](function(_0x37fedd){return initRealtime();})[_0xaf2c('0x6')](function(_0x4a7397){return db[_0xaf2c('0xb')]['findOne']({'attributes':['id',_0xaf2c('0xc')],'raw':!![]});})['then'](function(_0x2f5099){return setInterval(initRealtime,_0x2f5099[_0xaf2c('0xc')]*0x3e8);})[_0xaf2c('0xd')](function(_0xd891e9){console['log'](_0xd891e9);});}main();