749509540ec2dc432bd36a68b3dc1c2b28c29213
[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 _0xff60=['ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x40f991,_0x576819){var _0x38eca2=function(_0x2a586f){while(--_0x2a586f){_0x40f991['push'](_0x40f991['shift']());}};_0x38eca2(++_0x576819);}(_0xff60,0x14c));var _0x0ff6=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xff60[_0x411add];return _0x238242;};'use strict';var _=require(_0x0ff6('0x0'));var util=require('util');var moment=require(_0x0ff6('0x1'));var BPromise=require(_0x0ff6('0x2'));var rs=require(_0x0ff6('0x3'));var fs=require('fs');var Redis=require(_0x0ff6('0x4'));var db=require(_0x0ff6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0ff6('0x6'))(_0x0ff6('0x7'));var config=require('../../config/environment');var jayson=require(_0x0ff6('0x8'));var client=jayson[_0x0ff6('0x9')][_0x0ff6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a707e,_0x1b4b3b,_0x11ffc1){return new BPromise(function(_0x1f0e41,_0x4d7356){return client[_0x0ff6('0xb')](_0x3a707e,_0x11ffc1)[_0x0ff6('0xc')](function(_0x41e0ce){logger[_0x0ff6('0xd')](_0x0ff6('0xe'),_0x1b4b3b,_0x0ff6('0xf'));logger[_0x0ff6('0x10')](_0x0ff6('0x11'),_0x1b4b3b,_0x0ff6('0xf'),JSON[_0x0ff6('0x12')](_0x41e0ce));if(_0x41e0ce[_0x0ff6('0x13')]){if(_0x41e0ce[_0x0ff6('0x13')][_0x0ff6('0x14')]===0x1f4){logger[_0x0ff6('0x13')](_0x0ff6('0xe'),_0x1b4b3b,_0x41e0ce[_0x0ff6('0x13')][_0x0ff6('0x15')]);return _0x4d7356(_0x41e0ce['error'][_0x0ff6('0x15')]);}logger['error'](_0x0ff6('0xe'),_0x1b4b3b,_0x41e0ce[_0x0ff6('0x13')][_0x0ff6('0x15')]);return _0x1f0e41(_0x41e0ce[_0x0ff6('0x13')]['message']);}else{logger['info'](_0x0ff6('0xe'),_0x1b4b3b,_0x0ff6('0xf'));_0x1f0e41(_0x41e0ce[_0x0ff6('0x16')]['message']);}})[_0x0ff6('0x17')](function(_0x3c9772){logger[_0x0ff6('0x13')](_0x0ff6('0xe'),_0x1b4b3b,_0x3c9772);_0x4d7356(_0x3c9772);});});}