Built motion from commit (unavailable).|2.4.18
[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 _0x0595=['info','MailServerOut,\x20%s,\x20%s','MailServerOut,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0x0595,0x1ec));var _0x5059=function(_0x3378ff,_0x280326){_0x3378ff=_0x3378ff-0x0;var _0x13bf82=_0x0595[_0x3378ff];return _0x13bf82;};'use strict';var _=require('lodash');var util=require(_0x5059('0x0'));var moment=require(_0x5059('0x1'));var BPromise=require(_0x5059('0x2'));var rs=require(_0x5059('0x3'));var fs=require('fs');var Redis=require(_0x5059('0x4'));var db=require(_0x5059('0x5'))['db'];var utils=require(_0x5059('0x6'));var logger=require(_0x5059('0x7'))('rpc');var config=require(_0x5059('0x8'));var jayson=require(_0x5059('0x9'));var client=jayson[_0x5059('0xa')][_0x5059('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5676eb,_0x1d43f8,_0x3edb8a){return new BPromise(function(_0x4dec62,_0x38ac79){return client[_0x5059('0xc')](_0x5676eb,_0x3edb8a)[_0x5059('0xd')](function(_0x220621){logger[_0x5059('0xe')](_0x5059('0xf'),_0x1d43f8,'request\x20sent');logger['debug'](_0x5059('0x10'),_0x1d43f8,_0x5059('0x11'),JSON[_0x5059('0x12')](_0x220621));if(_0x220621[_0x5059('0x13')]){if(_0x220621[_0x5059('0x13')][_0x5059('0x14')]===0x1f4){logger['error'](_0x5059('0xf'),_0x1d43f8,_0x220621[_0x5059('0x13')]['message']);return _0x38ac79(_0x220621['error']['message']);}logger['error']('MailServerOut,\x20%s,\x20%s',_0x1d43f8,_0x220621['error'][_0x5059('0x15')]);return _0x4dec62(_0x220621[_0x5059('0x13')][_0x5059('0x15')]);}else{logger['info'](_0x5059('0xf'),_0x1d43f8,_0x5059('0x11'));_0x4dec62(_0x220621[_0x5059('0x16')][_0x5059('0x15')]);}})['catch'](function(_0x5f4998){logger[_0x5059('0x13')](_0x5059('0xf'),_0x1d43f8,_0x5f4998);_0x38ac79(_0x5f4998);});});}