d258aaefa9b4a578e069c73f1a1a2eaeb1e08cf5
[motion2.git] / server / api / mailServerOut / mailServerOut.rpc.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 _0xc779=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird'];(function(_0x454709,_0xa28117){var _0x3fb5dc=function(_0x49dbb2){while(--_0x49dbb2){_0x454709['push'](_0x454709['shift']());}};_0x3fb5dc(++_0xa28117);}(_0xc779,0x151));var _0x9c77=function(_0x235388,_0x11b58a){_0x235388=_0x235388-0x0;var _0x349985=_0xc779[_0x235388];return _0x349985;};'use strict';var _=require(_0x9c77('0x0'));var util=require('util');var moment=require(_0x9c77('0x1'));var BPromise=require(_0x9c77('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9c77('0x3'));var db=require(_0x9c77('0x4'))['db'];var utils=require(_0x9c77('0x5'));var logger=require(_0x9c77('0x6'))(_0x9c77('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x9c77('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4e27b1,_0x386c14,_0x3bceb4){return new BPromise(function(_0x52b533,_0x1a3444){return client[_0x9c77('0x9')](_0x4e27b1,_0x3bceb4)[_0x9c77('0xa')](function(_0x1b8888){logger[_0x9c77('0xb')](_0x9c77('0xc'),_0x386c14,_0x9c77('0xd'));logger['debug'](_0x9c77('0xe'),_0x386c14,_0x9c77('0xd'),JSON[_0x9c77('0xf')](_0x1b8888));if(_0x1b8888[_0x9c77('0x10')]){if(_0x1b8888[_0x9c77('0x10')][_0x9c77('0x11')]===0x1f4){logger['error'](_0x9c77('0xc'),_0x386c14,_0x1b8888[_0x9c77('0x10')][_0x9c77('0x12')]);return _0x1a3444(_0x1b8888[_0x9c77('0x10')][_0x9c77('0x12')]);}logger[_0x9c77('0x10')](_0x9c77('0xc'),_0x386c14,_0x1b8888[_0x9c77('0x10')][_0x9c77('0x12')]);return _0x52b533(_0x1b8888[_0x9c77('0x10')]['message']);}else{logger[_0x9c77('0xb')](_0x9c77('0xc'),_0x386c14,_0x9c77('0xd'));_0x52b533(_0x1b8888[_0x9c77('0x13')]['message']);}})['catch'](function(_0x3730af){logger['error'](_0x9c77('0xc'),_0x386c14,_0x3730af);_0x1a3444(_0x3730af);});});}