c38f194d039b77f511d57ea58237d9d7d8335e18
[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 _0x2f9f=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','error','code','message','MailServerOut,\x20%s,\x20%s','catch'];(function(_0x18fb16,_0x45edbc){var _0x147b0d=function(_0x5b1b00){while(--_0x5b1b00){_0x18fb16['push'](_0x18fb16['shift']());}};_0x147b0d(++_0x45edbc);}(_0x2f9f,0x1d4));var _0xf2f9=function(_0x4c3d23,_0xeb5cfa){_0x4c3d23=_0x4c3d23-0x0;var _0x5d46bc=_0x2f9f[_0x4c3d23];return _0x5d46bc;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xf2f9('0x0'));var rs=require(_0xf2f9('0x1'));var fs=require('fs');var Redis=require(_0xf2f9('0x2'));var db=require(_0xf2f9('0x3'))['db'];var utils=require(_0xf2f9('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xf2f9('0x5'));var jayson=require(_0xf2f9('0x6'));var client=jayson['client'][_0xf2f9('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5a2764,_0x346c2f,_0x2cdf6f){return new BPromise(function(_0x4da350,_0x54451e){return client[_0xf2f9('0x8')](_0x5a2764,_0x2cdf6f)[_0xf2f9('0x9')](function(_0x285cf3){logger[_0xf2f9('0xa')]('MailServerOut,\x20%s,\x20%s',_0x346c2f,_0xf2f9('0xb'));logger[_0xf2f9('0xc')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x346c2f,_0xf2f9('0xb'),JSON['stringify'](_0x285cf3));if(_0x285cf3[_0xf2f9('0xd')]){if(_0x285cf3[_0xf2f9('0xd')][_0xf2f9('0xe')]===0x1f4){logger['error']('MailServerOut,\x20%s,\x20%s',_0x346c2f,_0x285cf3[_0xf2f9('0xd')][_0xf2f9('0xf')]);return _0x54451e(_0x285cf3[_0xf2f9('0xd')][_0xf2f9('0xf')]);}logger[_0xf2f9('0xd')](_0xf2f9('0x10'),_0x346c2f,_0x285cf3[_0xf2f9('0xd')][_0xf2f9('0xf')]);return _0x4da350(_0x285cf3[_0xf2f9('0xd')][_0xf2f9('0xf')]);}else{logger[_0xf2f9('0xa')](_0xf2f9('0x10'),_0x346c2f,_0xf2f9('0xb'));_0x4da350(_0x285cf3['result']['message']);}})[_0xf2f9('0x11')](function(_0x5efc6f){logger['error'](_0xf2f9('0x10'),_0x346c2f,_0x5efc6f);_0x54451e(_0x5efc6f);});});}