Built motion from commit (unavailable).|2.5.14
[motion2.git] / server / services / email / server / 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 _0x1bbe=['sendMail','then','catch','error','verifySmtp','account','Verified','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','listen','127.0.0.1','log','bluebird','lodash','email'];(function(_0x550aed,_0x1ba6cb){var _0x1c43a5=function(_0x39e5f7){while(--_0x39e5f7){_0x550aed['push'](_0x550aed['shift']());}};_0x1c43a5(++_0x1ba6cb);}(_0x1bbe,0x13f));var _0xe1bb=function(_0x51d2c5,_0x13ea90){_0x51d2c5=_0x51d2c5-0x0;var _0x47caff=_0x1bbe[_0x51d2c5];return _0x47caff;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xe1bb('0x0'));var _=require(_0xe1bb('0x1'));var logger=require('../../../config/logger')(_0xe1bb('0x2'));exports['listen']=function(_0x4285e9,_0x28a5f0){return new BPromise(function(_0x2ff8a6,_0x24eed6){var _0xe11bbf={'SendMail':function(_0x188bc0){var _0x14dccb=this;return new Promise(function(_0x1b7752,_0x19c6fd){_0x28a5f0[_0xe1bb('0x3')](_0x188bc0['account'],_0x188bc0['message'])[_0xe1bb('0x4')](function(_0x2a2a3d){_0x1b7752({'code':0xc8,'message':_0x2a2a3d});})[_0xe1bb('0x5')](function(_0x10db08){_0x19c6fd(_0x14dccb[_0xe1bb('0x6')](0x1f4,_0x10db08));});});},'VerifySmtp':function(_0x59cf71){var _0x4363a8=this;return new Promise(function(_0x325616,_0x2aba6f){_0x28a5f0[_0xe1bb('0x7')](_0x59cf71[_0xe1bb('0x8')])[_0xe1bb('0x4')](function(_0x230955){_0x325616({'code':0xc8,'message':_0xe1bb('0x9')});})[_0xe1bb('0x5')](function(_0x46ed87){_0x2aba6f(_0x4363a8[_0xe1bb('0x6')](0x1f4,_0x46ed87));});});},'MailAccounts':function(_0xb07ba5){return new Promise(function(_0x3ba007,_0x590475){var _0x140200=_[_0xe1bb('0xa')](_0x4285e9[_0xe1bb('0xb')]);for(var _0x24ba63=0x0;_0x24ba63<_0x140200[_0xe1bb('0xc')];_0x24ba63+=0x1){if(_0x140200[_0x24ba63]['Imap']&&_0x140200[_0x24ba63][_0xe1bb('0xd')]['password']){delete _0x140200[_0x24ba63][_0xe1bb('0xd')][_0xe1bb('0xe')];}if(_0x140200[_0x24ba63][_0xe1bb('0xf')]&&_0x140200[_0x24ba63][_0xe1bb('0xf')][_0xe1bb('0x10')]){delete _0x140200[_0x24ba63][_0xe1bb('0xf')]['pass'];}}_0x3ba007({'count':_0x140200[_0xe1bb('0xc')],'rows':_0x140200});});}};var _0x12a47b=jayson[_0xe1bb('0x11')](_0xe11bbf)[_0xe1bb('0x12')]();_0x12a47b['on'](_0xe1bb('0x6'),function(_0x8ab98){logger[_0xe1bb('0x6')](JSON[_0xe1bb('0x13')](_0x8ab98));return _0x24eed6(_0x8ab98);});_0x12a47b[_0xe1bb('0x14')](0x232b,_0xe1bb('0x15'),function(){console[_0xe1bb('0x16')]('Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232b);return _0x2ff8a6('RPC\x20listening\x20on\x20port:'+0x232b);});});};