626acd340e96c4fcce58a448e85d387c7016711b
[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 _0x267c=['error','code','message','info','result','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','MailServerOut,\x20%s,\x20%s','debug','MailServerOut,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x12a356,_0x498bcd){var _0x213bc5=function(_0x2da2a4){while(--_0x2da2a4){_0x12a356['push'](_0x12a356['shift']());}};_0x213bc5(++_0x498bcd);}(_0x267c,0x1aa));var _0xc267=function(_0x49f5b2,_0xd50e54){_0x49f5b2=_0x49f5b2-0x0;var _0x3d6622=_0x267c[_0x49f5b2];return _0x3d6622;};'use strict';var _=require('lodash');var util=require(_0xc267('0x0'));var moment=require('moment');var BPromise=require(_0xc267('0x1'));var rs=require(_0xc267('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc267('0x3'))['db'];var utils=require(_0xc267('0x4'));var logger=require(_0xc267('0x5'))('rpc');var config=require(_0xc267('0x6'));var jayson=require(_0xc267('0x7'));var client=jayson['client'][_0xc267('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3c2e91,_0x205d57,_0x142121){return new BPromise(function(_0x199b64,_0x890c4){return client[_0xc267('0x9')](_0x3c2e91,_0x142121)[_0xc267('0xa')](function(_0x359d22){logger['info'](_0xc267('0xb'),_0x205d57,'request\x20sent');logger[_0xc267('0xc')](_0xc267('0xd'),_0x205d57,_0xc267('0xe'),JSON['stringify'](_0x359d22));if(_0x359d22['error']){if(_0x359d22[_0xc267('0xf')][_0xc267('0x10')]===0x1f4){logger[_0xc267('0xf')](_0xc267('0xb'),_0x205d57,_0x359d22['error'][_0xc267('0x11')]);return _0x890c4(_0x359d22[_0xc267('0xf')][_0xc267('0x11')]);}logger[_0xc267('0xf')](_0xc267('0xb'),_0x205d57,_0x359d22[_0xc267('0xf')]['message']);return _0x199b64(_0x359d22['error'][_0xc267('0x11')]);}else{logger[_0xc267('0x12')](_0xc267('0xb'),_0x205d57,'request\x20sent');_0x199b64(_0x359d22[_0xc267('0x13')][_0xc267('0x11')]);}})[_0xc267('0x14')](function(_0x2978f4){logger[_0xc267('0xf')](_0xc267('0xb'),_0x205d57,_0x2978f4);_0x890c4(_0x2978f4);});});}