Built motion from commit 753c950e.|2.5.42
[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 _0xa5fd=['redis','defaults','localhost','request','info','ChatGroup,\x20%s,\x20%s','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http'];(function(_0x433af3,_0x2af31d){var _0x599249=function(_0xcefbd7){while(--_0xcefbd7){_0x433af3['push'](_0x433af3['shift']());}};_0x599249(++_0x2af31d);}(_0xa5fd,0x90));var _0xda5f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa5fd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xda5f('0x0'));var util=require('util');var moment=require(_0xda5f('0x1'));var BPromise=require(_0xda5f('0x2'));var rs=require(_0xda5f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xda5f('0x4'))['db'];var utils=require(_0xda5f('0x5'));var logger=require(_0xda5f('0x6'))(_0xda5f('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xda5f('0x8')][_0xda5f('0x9')]({'port':0x232a});config[_0xda5f('0xa')]=_[_0xda5f('0xb')](config[_0xda5f('0xa')],{'host':_0xda5f('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xda5f('0xa')]));require('./chatGroup.socket')['register'](socket);function respondWithRpcPromise(_0x495366,_0x246511,_0x5cfad5){return new BPromise(function(_0x20e9cf,_0x4ee788){return client[_0xda5f('0xd')](_0x495366,_0x5cfad5)['then'](function(_0x27e6fe){logger[_0xda5f('0xe')](_0xda5f('0xf'),_0x246511,'request\x20sent');logger['debug'](_0xda5f('0x10'),_0x246511,_0xda5f('0x11'),JSON[_0xda5f('0x12')](_0x27e6fe));if(_0x27e6fe[_0xda5f('0x13')]){if(_0x27e6fe['error'][_0xda5f('0x14')]===0x1f4){logger[_0xda5f('0x13')]('ChatGroup,\x20%s,\x20%s',_0x246511,_0x27e6fe[_0xda5f('0x13')][_0xda5f('0x15')]);return _0x4ee788(_0x27e6fe[_0xda5f('0x13')][_0xda5f('0x15')]);}logger[_0xda5f('0x13')](_0xda5f('0xf'),_0x246511,_0x27e6fe[_0xda5f('0x13')][_0xda5f('0x15')]);return _0x20e9cf(_0x27e6fe[_0xda5f('0x13')][_0xda5f('0x15')]);}else{logger[_0xda5f('0xe')](_0xda5f('0xf'),_0x246511,'request\x20sent');_0x20e9cf(_0x27e6fe['result'][_0xda5f('0x15')]);}})['catch'](function(_0x2682bf){logger['error']('ChatGroup,\x20%s,\x20%s',_0x246511,_0x2682bf);_0x4ee788(_0x2682bf);});});}