9a83748e472e7f88cc11ff5159c28b729037c5fe
[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 _0x6898=['debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','ChatGroup,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','info','request\x20sent'];(function(_0x496221,_0xe39993){var _0x5b0642=function(_0x5d0214){while(--_0x5d0214){_0x496221['push'](_0x496221['shift']());}};_0x5b0642(++_0xe39993);}(_0x6898,0x11b));var _0x8689=function(_0x14c92a,_0x572f2e){_0x14c92a=_0x14c92a-0x0;var _0x7065f=_0x6898[_0x14c92a];return _0x7065f;};'use strict';var _=require(_0x8689('0x0'));var util=require('util');var moment=require(_0x8689('0x1'));var BPromise=require(_0x8689('0x2'));var rs=require(_0x8689('0x3'));var fs=require('fs');var Redis=require(_0x8689('0x4'));var db=require(_0x8689('0x5'))['db'];var utils=require(_0x8689('0x6'));var logger=require(_0x8689('0x7'))('rpc');var config=require(_0x8689('0x8'));var jayson=require(_0x8689('0x9'));var client=jayson[_0x8689('0xa')]['http']({'port':0x232a});config[_0x8689('0xb')]=_[_0x8689('0xc')](config[_0x8689('0xb')],{'host':_0x8689('0xd'),'port':0x18eb});var socket=require(_0x8689('0xe'))(new Redis(config[_0x8689('0xb')]));require('./chatGroup.socket')['register'](socket);function respondWithRpcPromise(_0x5d8d64,_0x39fb70,_0x573c98){return new BPromise(function(_0x24e15a,_0x3d5a38){return client['request'](_0x5d8d64,_0x573c98)['then'](function(_0x22549b){logger[_0x8689('0xf')]('ChatGroup,\x20%s,\x20%s',_0x39fb70,_0x8689('0x10'));logger[_0x8689('0x11')](_0x8689('0x12'),_0x39fb70,'request\x20sent',JSON[_0x8689('0x13')](_0x22549b));if(_0x22549b['error']){if(_0x22549b['error']['code']===0x1f4){logger[_0x8689('0x14')](_0x8689('0x15'),_0x39fb70,_0x22549b[_0x8689('0x14')][_0x8689('0x16')]);return _0x3d5a38(_0x22549b[_0x8689('0x14')][_0x8689('0x16')]);}logger['error'](_0x8689('0x15'),_0x39fb70,_0x22549b['error'][_0x8689('0x16')]);return _0x24e15a(_0x22549b[_0x8689('0x14')]['message']);}else{logger[_0x8689('0xf')](_0x8689('0x15'),_0x39fb70,_0x8689('0x10'));_0x24e15a(_0x22549b[_0x8689('0x17')][_0x8689('0x16')]);}})[_0x8689('0x18')](function(_0x3bfc02){logger[_0x8689('0x14')](_0x8689('0x15'),_0x39fb70,_0x3bfc02);_0x3d5a38(_0x3bfc02);});});}