4a90df4b631400ad282417319c73b07e056ebcee
[motion2.git] / server / api / chatGroup / chatGroup.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 _0x046e=['../../mysqldb','../../config/logger','jayson/promise','redis','localhost','./chatGroup.socket','register','then','info','ChatGroup,\x20%s,\x20%s','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','lodash','moment','randomstring','ioredis'];(function(_0x4da702,_0x5d13bb){var _0x1af125=function(_0x1a265b){while(--_0x1a265b){_0x4da702['push'](_0x4da702['shift']());}};_0x1af125(++_0x5d13bb);}(_0x046e,0x1b4));var _0xe046=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x046e[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xe046('0x0'));var util=require('util');var moment=require(_0xe046('0x1'));var BPromise=require('bluebird');var rs=require(_0xe046('0x2'));var fs=require('fs');var Redis=require(_0xe046('0x3'));var db=require(_0xe046('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe046('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe046('0x6'));var client=jayson['client']['http']({'port':0x232a});config[_0xe046('0x7')]=_['defaults'](config[_0xe046('0x7')],{'host':_0xe046('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe046('0x7')]));require(_0xe046('0x9'))[_0xe046('0xa')](socket);function respondWithRpcPromise(_0x2ee32e,_0xd38bc7,_0x1b29fd){return new BPromise(function(_0x4653d5,_0x356f13){return client['request'](_0x2ee32e,_0x1b29fd)[_0xe046('0xb')](function(_0x451e1b){logger[_0xe046('0xc')](_0xe046('0xd'),_0xd38bc7,'request\x20sent');logger[_0xe046('0xe')](_0xe046('0xf'),_0xd38bc7,'request\x20sent',JSON[_0xe046('0x10')](_0x451e1b));if(_0x451e1b[_0xe046('0x11')]){if(_0x451e1b['error']['code']===0x1f4){logger[_0xe046('0x11')](_0xe046('0xd'),_0xd38bc7,_0x451e1b['error'][_0xe046('0x12')]);return _0x356f13(_0x451e1b[_0xe046('0x11')][_0xe046('0x12')]);}logger[_0xe046('0x11')](_0xe046('0xd'),_0xd38bc7,_0x451e1b[_0xe046('0x11')][_0xe046('0x12')]);return _0x4653d5(_0x451e1b['error'][_0xe046('0x12')]);}else{logger[_0xe046('0xc')]('ChatGroup,\x20%s,\x20%s',_0xd38bc7,_0xe046('0x13'));_0x4653d5(_0x451e1b[_0xe046('0x14')][_0xe046('0x12')]);}})[_0xe046('0x15')](function(_0xaac59b){logger[_0xe046('0x11')](_0xe046('0xd'),_0xd38bc7,_0xaac59b);_0x356f13(_0xaac59b);});});}