Built motion from commit 9d0783e6.|2.6.13
[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 _0x06f4=['request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatGroup,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./chatGroup.socket','request','info'];(function(_0x2acfed,_0x1526b3){var _0x5b7b43=function(_0x20f95d){while(--_0x20f95d){_0x2acfed['push'](_0x2acfed['shift']());}};_0x5b7b43(++_0x1526b3);}(_0x06f4,0x136));var _0x406f=function(_0x10946b,_0x415d73){_0x10946b=_0x10946b-0x0;var _0x4351ef=_0x06f4[_0x10946b];return _0x4351ef;};'use strict';var _=require(_0x406f('0x0'));var util=require(_0x406f('0x1'));var moment=require('moment');var BPromise=require(_0x406f('0x2'));var rs=require(_0x406f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x406f('0x4'));var logger=require('../../config/logger')(_0x406f('0x5'));var config=require(_0x406f('0x6'));var jayson=require(_0x406f('0x7'));var client=jayson[_0x406f('0x8')]['http']({'port':0x232a});config[_0x406f('0x9')]=_['defaults'](config[_0x406f('0x9')],{'host':_0x406f('0xa'),'port':0x18eb});var socket=require(_0x406f('0xb'))(new Redis(config['redis']));require(_0x406f('0xc'))['register'](socket);function respondWithRpcPromise(_0x5b46bf,_0xd817eb,_0x56edc2){return new BPromise(function(_0x28c5a5,_0x4e0e96){return client[_0x406f('0xd')](_0x5b46bf,_0x56edc2)['then'](function(_0xb2c62d){logger[_0x406f('0xe')]('ChatGroup,\x20%s,\x20%s',_0xd817eb,_0x406f('0xf'));logger[_0x406f('0x10')](_0x406f('0x11'),_0xd817eb,_0x406f('0xf'),JSON[_0x406f('0x12')](_0xb2c62d));if(_0xb2c62d[_0x406f('0x13')]){if(_0xb2c62d[_0x406f('0x13')][_0x406f('0x14')]===0x1f4){logger[_0x406f('0x13')](_0x406f('0x15'),_0xd817eb,_0xb2c62d[_0x406f('0x13')]['message']);return _0x4e0e96(_0xb2c62d[_0x406f('0x13')][_0x406f('0x16')]);}logger[_0x406f('0x13')]('ChatGroup,\x20%s,\x20%s',_0xd817eb,_0xb2c62d[_0x406f('0x13')][_0x406f('0x16')]);return _0x28c5a5(_0xb2c62d['error']['message']);}else{logger[_0x406f('0xe')](_0x406f('0x15'),_0xd817eb,'request\x20sent');_0x28c5a5(_0xb2c62d[_0x406f('0x17')]['message']);}})[_0x406f('0x18')](function(_0x3ad3fe){logger[_0x406f('0x13')](_0x406f('0x15'),_0xd817eb,_0x3ad3fe);_0x4e0e96(_0x3ad3fe);});});}