43f7208e28be5709116bdf0df9910913e7245205
[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 _0x45da=['rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','stringify','error','code','MailServerOut,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x644ecd,_0x397f36){var _0x1c66ce=function(_0x4cf42b){while(--_0x4cf42b){_0x644ecd['push'](_0x644ecd['shift']());}};_0x1c66ce(++_0x397f36);}(_0x45da,0xd6));var _0xa45d=function(_0x21a7bf,_0x25e3aa){_0x21a7bf=_0x21a7bf-0x0;var _0x5b68b1=_0x45da[_0x21a7bf];return _0x5b68b1;};'use strict';var _=require('lodash');var util=require(_0xa45d('0x0'));var moment=require(_0xa45d('0x1'));var BPromise=require(_0xa45d('0x2'));var rs=require(_0xa45d('0x3'));var fs=require('fs');var Redis=require(_0xa45d('0x4'));var db=require(_0xa45d('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa45d('0x6'));var config=require(_0xa45d('0x7'));var jayson=require(_0xa45d('0x8'));var client=jayson['client'][_0xa45d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x856bc1,_0x39b663,_0x3d45a1){return new BPromise(function(_0x970b35,_0x11caa4){return client[_0xa45d('0xa')](_0x856bc1,_0x3d45a1)[_0xa45d('0xb')](function(_0x55ead2){logger[_0xa45d('0xc')]('MailServerOut,\x20%s,\x20%s',_0x39b663,_0xa45d('0xd'));logger[_0xa45d('0xe')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x39b663,_0xa45d('0xd'),JSON[_0xa45d('0xf')](_0x55ead2));if(_0x55ead2[_0xa45d('0x10')]){if(_0x55ead2[_0xa45d('0x10')][_0xa45d('0x11')]===0x1f4){logger[_0xa45d('0x10')](_0xa45d('0x12'),_0x39b663,_0x55ead2['error'][_0xa45d('0x13')]);return _0x11caa4(_0x55ead2[_0xa45d('0x10')][_0xa45d('0x13')]);}logger[_0xa45d('0x10')](_0xa45d('0x12'),_0x39b663,_0x55ead2[_0xa45d('0x10')]['message']);return _0x970b35(_0x55ead2[_0xa45d('0x10')][_0xa45d('0x13')]);}else{logger['info']('MailServerOut,\x20%s,\x20%s',_0x39b663,_0xa45d('0xd'));_0x970b35(_0x55ead2[_0xa45d('0x14')][_0xa45d('0x13')]);}})[_0xa45d('0x15')](function(_0x154009){logger['error'](_0xa45d('0x12'),_0x39b663,_0x154009);_0x11caa4(_0x154009);});});}