3d26f891564ddbb401293dc399da995c8573696f
[motion2.git] / server / api / chatInternalMessage / chatInternalMessage.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 _0xc7e6=['register','request','then','info','request\x20sent','error','code','ChatInternalMessage,\x20%s,\x20%s','message','result','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','redis','socket.io-emitter','./chatInternalMessage.socket'];(function(_0x2da871,_0x77f588){var _0x4984bd=function(_0x1d9f2d){while(--_0x1d9f2d){_0x2da871['push'](_0x2da871['shift']());}};_0x4984bd(++_0x77f588);}(_0xc7e6,0x1ef));var _0x6c7e=function(_0x5162ed,_0x386cb7){_0x5162ed=_0x5162ed-0x0;var _0x4c579b=_0xc7e6[_0x5162ed];return _0x4c579b;};'use strict';var _=require(_0x6c7e('0x0'));var util=require(_0x6c7e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6c7e('0x2'));var db=require(_0x6c7e('0x3'))['db'];var utils=require(_0x6c7e('0x4'));var logger=require('../../config/logger')(_0x6c7e('0x5'));var config=require('../../config/environment');var jayson=require(_0x6c7e('0x6'));var client=jayson['client'][_0x6c7e('0x7')]({'port':0x232a});config['redis']=_['defaults'](config[_0x6c7e('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x6c7e('0x9'))(new Redis(config[_0x6c7e('0x8')]));require(_0x6c7e('0xa'))[_0x6c7e('0xb')](socket);function respondWithRpcPromise(_0x4da581,_0x250276,_0x1a27c9){return new BPromise(function(_0x407fd4,_0x50cfcf){return client[_0x6c7e('0xc')](_0x4da581,_0x1a27c9)[_0x6c7e('0xd')](function(_0xa3761e){logger[_0x6c7e('0xe')]('ChatInternalMessage,\x20%s,\x20%s',_0x250276,_0x6c7e('0xf'));logger['debug']('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x250276,'request\x20sent',JSON['stringify'](_0xa3761e));if(_0xa3761e['error']){if(_0xa3761e[_0x6c7e('0x10')][_0x6c7e('0x11')]===0x1f4){logger['error'](_0x6c7e('0x12'),_0x250276,_0xa3761e['error']['message']);return _0x50cfcf(_0xa3761e['error'][_0x6c7e('0x13')]);}logger['error'](_0x6c7e('0x12'),_0x250276,_0xa3761e[_0x6c7e('0x10')][_0x6c7e('0x13')]);return _0x407fd4(_0xa3761e[_0x6c7e('0x10')][_0x6c7e('0x13')]);}else{logger[_0x6c7e('0xe')](_0x6c7e('0x12'),_0x250276,_0x6c7e('0xf'));_0x407fd4(_0xa3761e[_0x6c7e('0x14')]['message']);}})[_0x6c7e('0x15')](function(_0x25d380){logger[_0x6c7e('0x10')](_0x6c7e('0x12'),_0x250276,_0x25d380);_0x50cfcf(_0x25d380);});});}