Built motion from commit (unavailable).|2.5.0
[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 _0xfc65=['catch','bluebird','./lib/email','./rpc/mailAccount','../../mysqldb','resolve','then','getMailAccounts','initMailAccounts','refresh','mailAccounts','listen','Setting','findOne','loginMailFrequency'];(function(_0x334599,_0x4b1cfa){var _0x4cdff2=function(_0x297be7){while(--_0x297be7){_0x334599['push'](_0x334599['shift']());}};_0x4cdff2(++_0x4b1cfa);}(_0xfc65,0x1e1));var _0x5fc6=function(_0x1cfbac,_0x4b087a){_0x1cfbac=_0x1cfbac-0x0;var _0x555297=_0xfc65[_0x1cfbac];return _0x555297;};'use strict';var BPromise=require(_0x5fc6('0x0'));var server=require('./server');var Realtime=require('./realtime');var EmailChannel=require(_0x5fc6('0x1'));var mailAccount=require(_0x5fc6('0x2'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0x5fc6('0x3'))['db'];function initRealtime(){return BPromise[_0x5fc6('0x4')]()[_0x5fc6('0x5')](mailAccount[_0x5fc6('0x6')]())[_0x5fc6('0x5')](realtime[_0x5fc6('0x7')]())[_0x5fc6('0x5')](function(){email[_0x5fc6('0x8')](realtime[_0x5fc6('0x9')]);return realtime;});}function main(){return server[_0x5fc6('0xa')](realtime,email)[_0x5fc6('0x5')](function(_0x572941){return initRealtime();})[_0x5fc6('0x5')](function(_0x1f1409){return db[_0x5fc6('0xb')][_0x5fc6('0xc')]({'attributes':['id',_0x5fc6('0xd')],'raw':!![]});})[_0x5fc6('0x5')](function(_0x23c4e2){return setInterval(initRealtime,_0x23c4e2[_0x5fc6('0xd')]*0x3e8);})[_0x5fc6('0xe')](function(_0x29781f){console['log'](_0x29781f);});}main();