3f39af4d7e81fa04134e56d74f49aad625543d74
[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 _0xf5a7=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x564be0,_0x2e8ec3){var _0x306e03=function(_0x4e5469){while(--_0x4e5469){_0x564be0['push'](_0x564be0['shift']());}};_0x306e03(++_0x2e8ec3);}(_0xf5a7,0x155));var _0x7f5a=function(_0x45a52a,_0x2675de){_0x45a52a=_0x45a52a-0x0;var _0x301b32=_0xf5a7[_0x45a52a];return _0x301b32;};'use strict';var _=require(_0x7f5a('0x0'));var util=require(_0x7f5a('0x1'));var moment=require(_0x7f5a('0x2'));var BPromise=require(_0x7f5a('0x3'));var rs=require(_0x7f5a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7f5a('0x5'))['db'];var utils=require(_0x7f5a('0x6'));var logger=require('../../config/logger')(_0x7f5a('0x7'));var config=require(_0x7f5a('0x8'));var jayson=require(_0x7f5a('0x9'));var client=jayson[_0x7f5a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b8199,_0x4a3e65,_0x62b91f){return new BPromise(function(_0x4a0678,_0x504863){return client['request'](_0x3b8199,_0x62b91f)[_0x7f5a('0xb')](function(_0x50e497){logger[_0x7f5a('0xc')](_0x7f5a('0xd'),_0x4a3e65,_0x7f5a('0xe'));logger[_0x7f5a('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x4a3e65,'request\x20sent',JSON['stringify'](_0x50e497));if(_0x50e497[_0x7f5a('0x10')]){if(_0x50e497['error'][_0x7f5a('0x11')]===0x1f4){logger[_0x7f5a('0x10')](_0x7f5a('0xd'),_0x4a3e65,_0x50e497[_0x7f5a('0x10')][_0x7f5a('0x12')]);return _0x504863(_0x50e497[_0x7f5a('0x10')][_0x7f5a('0x12')]);}logger[_0x7f5a('0x10')](_0x7f5a('0xd'),_0x4a3e65,_0x50e497['error'][_0x7f5a('0x12')]);return _0x4a0678(_0x50e497[_0x7f5a('0x10')][_0x7f5a('0x12')]);}else{logger[_0x7f5a('0xc')](_0x7f5a('0xd'),_0x4a3e65,_0x7f5a('0xe'));_0x4a0678(_0x50e497[_0x7f5a('0x13')][_0x7f5a('0x12')]);}})[_0x7f5a('0x14')](function(_0x1fc834){logger[_0x7f5a('0x10')](_0x7f5a('0xd'),_0x4a3e65,_0x1fc834);_0x504863(_0x1fc834);});});}