Built motion from commit (unavailable).|2.5.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 _0x6477=['rpc','jayson/promise','client','http','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util','moment','randomstring','ioredis','../../config/logger'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x6477,0x80));var _0x7647=function(_0x2459fd,_0x575d9b){_0x2459fd=_0x2459fd-0x0;var _0x364cd2=_0x6477[_0x2459fd];return _0x364cd2;};'use strict';var _=require('lodash');var util=require(_0x7647('0x0'));var moment=require(_0x7647('0x1'));var BPromise=require('bluebird');var rs=require(_0x7647('0x2'));var fs=require('fs');var Redis=require(_0x7647('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7647('0x4'))(_0x7647('0x5'));var config=require('../../config/environment');var jayson=require(_0x7647('0x6'));var client=jayson[_0x7647('0x7')][_0x7647('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x509704,_0x46fcc6,_0x3f3fed){return new BPromise(function(_0x40ab29,_0x2ca783){return client[_0x7647('0x9')](_0x509704,_0x3f3fed)[_0x7647('0xa')](function(_0x53ae0f){logger[_0x7647('0xb')](_0x7647('0xc'),_0x46fcc6,_0x7647('0xd'));logger['debug'](_0x7647('0xe'),_0x46fcc6,_0x7647('0xd'),JSON[_0x7647('0xf')](_0x53ae0f));if(_0x53ae0f[_0x7647('0x10')]){if(_0x53ae0f['error']['code']===0x1f4){logger[_0x7647('0x10')](_0x7647('0xc'),_0x46fcc6,_0x53ae0f[_0x7647('0x10')][_0x7647('0x11')]);return _0x2ca783(_0x53ae0f['error']['message']);}logger[_0x7647('0x10')](_0x7647('0xc'),_0x46fcc6,_0x53ae0f[_0x7647('0x10')][_0x7647('0x11')]);return _0x40ab29(_0x53ae0f['error'][_0x7647('0x11')]);}else{logger[_0x7647('0xb')](_0x7647('0xc'),_0x46fcc6,_0x7647('0xd'));_0x40ab29(_0x53ae0f['result'][_0x7647('0x11')]);}})[_0x7647('0x12')](function(_0x367995){logger['error'](_0x7647('0xc'),_0x46fcc6,_0x367995);_0x2ca783(_0x367995);});});}