7409703bbe80f28e3d69051889e2a8e04539097f
[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 _0xcd57=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','http','request','then','info','MailServerOut,\x20%s,\x20%s','MailServerOut,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash'];(function(_0x5d80de,_0x2cf15d){var _0x1c7556=function(_0x5bd806){while(--_0x5bd806){_0x5d80de['push'](_0x5d80de['shift']());}};_0x1c7556(++_0x2cf15d);}(_0xcd57,0x1a1));var _0x7cd5=function(_0x449b81,_0x4b2a6f){_0x449b81=_0x449b81-0x0;var _0xb9b60c=_0xcd57[_0x449b81];return _0xb9b60c;};'use strict';var _=require(_0x7cd5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7cd5('0x1'));var rs=require(_0x7cd5('0x2'));var fs=require('fs');var Redis=require(_0x7cd5('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7cd5('0x4'));var logger=require(_0x7cd5('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x7cd5('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4b7f75,_0x2e91df,_0x106d7f){return new BPromise(function(_0x3f87cb,_0x5eb719){return client[_0x7cd5('0x7')](_0x4b7f75,_0x106d7f)[_0x7cd5('0x8')](function(_0x4d9980){logger[_0x7cd5('0x9')](_0x7cd5('0xa'),_0x2e91df,'request\x20sent');logger['debug'](_0x7cd5('0xb'),_0x2e91df,_0x7cd5('0xc'),JSON[_0x7cd5('0xd')](_0x4d9980));if(_0x4d9980[_0x7cd5('0xe')]){if(_0x4d9980[_0x7cd5('0xe')][_0x7cd5('0xf')]===0x1f4){logger['error']('MailServerOut,\x20%s,\x20%s',_0x2e91df,_0x4d9980['error']['message']);return _0x5eb719(_0x4d9980[_0x7cd5('0xe')][_0x7cd5('0x10')]);}logger[_0x7cd5('0xe')](_0x7cd5('0xa'),_0x2e91df,_0x4d9980[_0x7cd5('0xe')][_0x7cd5('0x10')]);return _0x3f87cb(_0x4d9980[_0x7cd5('0xe')]['message']);}else{logger['info']('MailServerOut,\x20%s,\x20%s',_0x2e91df,_0x7cd5('0xc'));_0x3f87cb(_0x4d9980[_0x7cd5('0x11')][_0x7cd5('0x10')]);}})[_0x7cd5('0x12')](function(_0x544787){logger[_0x7cd5('0xe')]('MailServerOut,\x20%s,\x20%s',_0x2e91df,_0x544787);_0x5eb719(_0x544787);});});}