Built motion from commit (unavailable).|2.3.3
[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 _0x86e6=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','MailServerOut,\x20%s,\x20%s','request\x20sent','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','randomstring'];(function(_0x4ca99f,_0x464d1c){var _0x216622=function(_0x3afdc8){while(--_0x3afdc8){_0x4ca99f['push'](_0x4ca99f['shift']());}};_0x216622(++_0x464d1c);}(_0x86e6,0x1b1));var _0x686e=function(_0x11553f,_0x3495d4){_0x11553f=_0x11553f-0x0;var _0x1fba18=_0x86e6[_0x11553f];return _0x1fba18;};'use strict';var _=require(_0x686e('0x0'));var util=require(_0x686e('0x1'));var moment=require(_0x686e('0x2'));var BPromise=require('bluebird');var rs=require(_0x686e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x686e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x686e('0x5'))(_0x686e('0x6'));var config=require(_0x686e('0x7'));var jayson=require(_0x686e('0x8'));var client=jayson['client'][_0x686e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1b70ac,_0x3fca1d,_0x5e7cac){return new BPromise(function(_0x506b33,_0x11273f){return client['request'](_0x1b70ac,_0x5e7cac)['then'](function(_0x53ec76){logger[_0x686e('0xa')](_0x686e('0xb'),_0x3fca1d,_0x686e('0xc'));logger['debug'](_0x686e('0xd'),_0x3fca1d,_0x686e('0xc'),JSON[_0x686e('0xe')](_0x53ec76));if(_0x53ec76[_0x686e('0xf')]){if(_0x53ec76[_0x686e('0xf')]['code']===0x1f4){logger[_0x686e('0xf')](_0x686e('0xb'),_0x3fca1d,_0x53ec76[_0x686e('0xf')][_0x686e('0x10')]);return _0x11273f(_0x53ec76[_0x686e('0xf')][_0x686e('0x10')]);}logger['error'](_0x686e('0xb'),_0x3fca1d,_0x53ec76['error']['message']);return _0x506b33(_0x53ec76[_0x686e('0xf')][_0x686e('0x10')]);}else{logger[_0x686e('0xa')](_0x686e('0xb'),_0x3fca1d,'request\x20sent');_0x506b33(_0x53ec76[_0x686e('0x11')][_0x686e('0x10')]);}})[_0x686e('0x12')](function(_0x5b67f0){logger[_0x686e('0xf')](_0x686e('0xb'),_0x3fca1d,_0x5b67f0);_0x11273f(_0x5b67f0);});});}