Built motion from commit (unavailable).|2.3.4
[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 _0x66f3=['debug','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','error','code','message','MailServerOut,\x20%s,\x20%s','result','catch','lodash','util','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','request','then','request\x20sent'];(function(_0x7cf8eb,_0x5a470e){var _0x24e417=function(_0x10caea){while(--_0x10caea){_0x7cf8eb['push'](_0x7cf8eb['shift']());}};_0x24e417(++_0x5a470e);}(_0x66f3,0x185));var _0x366f=function(_0x4f6afc,_0x4dfa88){_0x4f6afc=_0x4f6afc-0x0;var _0x256eeb=_0x66f3[_0x4f6afc];return _0x256eeb;};'use strict';var _=require(_0x366f('0x0'));var util=require(_0x366f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x366f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x366f('0x3'))['db'];var utils=require(_0x366f('0x4'));var logger=require('../../config/logger')(_0x366f('0x5'));var config=require('../../config/environment');var jayson=require(_0x366f('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1ca82c,_0x350385,_0x57cbb2){return new BPromise(function(_0x516d21,_0x2aaf64){return client[_0x366f('0x7')](_0x1ca82c,_0x57cbb2)[_0x366f('0x8')](function(_0x47f71e){logger['info']('MailServerOut,\x20%s,\x20%s',_0x350385,_0x366f('0x9'));logger[_0x366f('0xa')](_0x366f('0xb'),_0x350385,_0x366f('0x9'),JSON[_0x366f('0xc')](_0x47f71e));if(_0x47f71e['error']){if(_0x47f71e[_0x366f('0xd')][_0x366f('0xe')]===0x1f4){logger['error']('MailServerOut,\x20%s,\x20%s',_0x350385,_0x47f71e[_0x366f('0xd')][_0x366f('0xf')]);return _0x2aaf64(_0x47f71e[_0x366f('0xd')][_0x366f('0xf')]);}logger[_0x366f('0xd')](_0x366f('0x10'),_0x350385,_0x47f71e[_0x366f('0xd')][_0x366f('0xf')]);return _0x516d21(_0x47f71e['error']['message']);}else{logger['info'](_0x366f('0x10'),_0x350385,'request\x20sent');_0x516d21(_0x47f71e[_0x366f('0x11')][_0x366f('0xf')]);}})[_0x366f('0x12')](function(_0x4a2bcb){logger[_0x366f('0xd')]('MailServerOut,\x20%s,\x20%s',_0x350385,_0x4a2bcb);_0x2aaf64(_0x4a2bcb);});});}