Built motion from commit 3e059bc2.|2.5.32
[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 _0x5f96=['debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','message','info','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./chatGroup.socket','register','request','ChatGroup,\x20%s,\x20%s'];(function(_0x2c165a,_0x74dd4e){var _0x486c1a=function(_0x17ee1d){while(--_0x17ee1d){_0x2c165a['push'](_0x2c165a['shift']());}};_0x486c1a(++_0x74dd4e);}(_0x5f96,0x75));var _0x65f9=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x5f96[_0x2c7618];return _0x5ce3f0;};'use strict';var _=require(_0x65f9('0x0'));var util=require(_0x65f9('0x1'));var moment=require(_0x65f9('0x2'));var BPromise=require(_0x65f9('0x3'));var rs=require(_0x65f9('0x4'));var fs=require('fs');var Redis=require(_0x65f9('0x5'));var db=require(_0x65f9('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x65f9('0x7'))('rpc');var config=require(_0x65f9('0x8'));var jayson=require(_0x65f9('0x9'));var client=jayson['client'][_0x65f9('0xa')]({'port':0x232a});config[_0x65f9('0xb')]=_['defaults'](config[_0x65f9('0xb')],{'host':_0x65f9('0xc'),'port':0x18eb});var socket=require(_0x65f9('0xd'))(new Redis(config[_0x65f9('0xb')]));require(_0x65f9('0xe'))[_0x65f9('0xf')](socket);function respondWithRpcPromise(_0x594509,_0x52991e,_0x177256){return new BPromise(function(_0x296301,_0x8b086){return client[_0x65f9('0x10')](_0x594509,_0x177256)['then'](function(_0x1ea8bc){logger['info'](_0x65f9('0x11'),_0x52991e,'request\x20sent');logger[_0x65f9('0x12')](_0x65f9('0x13'),_0x52991e,'request\x20sent',JSON[_0x65f9('0x14')](_0x1ea8bc));if(_0x1ea8bc[_0x65f9('0x15')]){if(_0x1ea8bc[_0x65f9('0x15')]['code']===0x1f4){logger[_0x65f9('0x15')]('ChatGroup,\x20%s,\x20%s',_0x52991e,_0x1ea8bc[_0x65f9('0x15')][_0x65f9('0x16')]);return _0x8b086(_0x1ea8bc['error'][_0x65f9('0x16')]);}logger[_0x65f9('0x15')]('ChatGroup,\x20%s,\x20%s',_0x52991e,_0x1ea8bc['error'][_0x65f9('0x16')]);return _0x296301(_0x1ea8bc[_0x65f9('0x15')][_0x65f9('0x16')]);}else{logger[_0x65f9('0x17')](_0x65f9('0x11'),_0x52991e,_0x65f9('0x18'));_0x296301(_0x1ea8bc[_0x65f9('0x19')][_0x65f9('0x16')]);}})[_0x65f9('0x1a')](function(_0x410e06){logger['error']('ChatGroup,\x20%s,\x20%s',_0x52991e,_0x410e06);_0x8b086(_0x410e06);});});}