b9b99e2f86b9545c6f98fc0ef3c396ed46a74df9
[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 _0xfc72=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','client','http','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0xea378b,_0x503912){var _0x271ec4=function(_0x2502f5){while(--_0x2502f5){_0xea378b['push'](_0xea378b['shift']());}};_0x271ec4(++_0x503912);}(_0xfc72,0x135));var _0x2fc7=function(_0xf529ba,_0x47f543){_0xf529ba=_0xf529ba-0x0;var _0xe7e86e=_0xfc72[_0xf529ba];return _0xe7e86e;};'use strict';var _=require(_0x2fc7('0x0'));var util=require(_0x2fc7('0x1'));var moment=require(_0x2fc7('0x2'));var BPromise=require(_0x2fc7('0x3'));var rs=require(_0x2fc7('0x4'));var fs=require('fs');var Redis=require(_0x2fc7('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2fc7('0x6'))('rpc');var config=require(_0x2fc7('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2fc7('0x8')][_0x2fc7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xd92706,_0x2124b9,_0x3ddd5a){return new BPromise(function(_0x59f1e4,_0x13ca2a){return client[_0x2fc7('0xa')](_0xd92706,_0x3ddd5a)[_0x2fc7('0xb')](function(_0x13cd12){logger[_0x2fc7('0xc')](_0x2fc7('0xd'),_0x2124b9,_0x2fc7('0xe'));logger[_0x2fc7('0xf')](_0x2fc7('0x10'),_0x2124b9,'request\x20sent',JSON[_0x2fc7('0x11')](_0x13cd12));if(_0x13cd12[_0x2fc7('0x12')]){if(_0x13cd12['error']['code']===0x1f4){logger['error'](_0x2fc7('0xd'),_0x2124b9,_0x13cd12[_0x2fc7('0x12')]['message']);return _0x13ca2a(_0x13cd12[_0x2fc7('0x12')]['message']);}logger[_0x2fc7('0x12')](_0x2fc7('0xd'),_0x2124b9,_0x13cd12[_0x2fc7('0x12')][_0x2fc7('0x13')]);return _0x59f1e4(_0x13cd12['error']['message']);}else{logger[_0x2fc7('0xc')](_0x2fc7('0xd'),_0x2124b9,_0x2fc7('0xe'));_0x59f1e4(_0x13cd12[_0x2fc7('0x14')][_0x2fc7('0x13')]);}})[_0x2fc7('0x15')](function(_0x5730be){logger[_0x2fc7('0x12')](_0x2fc7('0xd'),_0x2124b9,_0x5730be);_0x13ca2a(_0x5730be);});});}