Built motion from commit d5e4af8c.|2.6.23
[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 _0x1b69=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x57bff1,_0x29ec45){var _0x8173d0=function(_0x427bf7){while(--_0x427bf7){_0x57bff1['push'](_0x57bff1['shift']());}};_0x8173d0(++_0x29ec45);}(_0x1b69,0x190));var _0x91b6=function(_0x494d1f,_0x3f72ff){_0x494d1f=_0x494d1f-0x0;var _0x457b6e=_0x1b69[_0x494d1f];return _0x457b6e;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x91b6('0x0'));var rs=require(_0x91b6('0x1'));var fs=require('fs');var Redis=require(_0x91b6('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x91b6('0x3'));var logger=require(_0x91b6('0x4'))(_0x91b6('0x5'));var config=require(_0x91b6('0x6'));var jayson=require(_0x91b6('0x7'));var client=jayson[_0x91b6('0x8')][_0x91b6('0x9')]({'port':0x232a});config[_0x91b6('0xa')]=_[_0x91b6('0xb')](config[_0x91b6('0xa')],{'host':_0x91b6('0xc'),'port':0x18eb});var socket=require(_0x91b6('0xd'))(new Redis(config[_0x91b6('0xa')]));require(_0x91b6('0xe'))['register'](socket);function respondWithRpcPromise(_0x563f68,_0x579e5b,_0x3580be){return new BPromise(function(_0x416bdd,_0x59c9ea){return client[_0x91b6('0xf')](_0x563f68,_0x3580be)[_0x91b6('0x10')](function(_0x45b492){logger[_0x91b6('0x11')](_0x91b6('0x12'),_0x579e5b,_0x91b6('0x13'));logger['debug'](_0x91b6('0x14'),_0x579e5b,'request\x20sent',JSON[_0x91b6('0x15')](_0x45b492));if(_0x45b492[_0x91b6('0x16')]){if(_0x45b492[_0x91b6('0x16')][_0x91b6('0x17')]===0x1f4){logger['error'](_0x91b6('0x12'),_0x579e5b,_0x45b492[_0x91b6('0x16')][_0x91b6('0x18')]);return _0x59c9ea(_0x45b492[_0x91b6('0x16')][_0x91b6('0x18')]);}logger['error'](_0x91b6('0x12'),_0x579e5b,_0x45b492[_0x91b6('0x16')][_0x91b6('0x18')]);return _0x416bdd(_0x45b492[_0x91b6('0x16')]['message']);}else{logger['info'](_0x91b6('0x12'),_0x579e5b,_0x91b6('0x13'));_0x416bdd(_0x45b492[_0x91b6('0x19')][_0x91b6('0x18')]);}})[_0x91b6('0x1a')](function(_0x34f58b){logger['error'](_0x91b6('0x12'),_0x579e5b,_0x34f58b);_0x59c9ea(_0x34f58b);});});}