57aef3f6ccf3ba0475468890f8203aff13675ac8
[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 _0xf489=['localhost','socket.io-emitter','register','request','then','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis'];(function(_0x1485a8,_0x11677e){var _0x23bcc7=function(_0xc46720){while(--_0xc46720){_0x1485a8['push'](_0x1485a8['shift']());}};_0x23bcc7(++_0x11677e);}(_0xf489,0x10b));var _0x9f48=function(_0x169f7b,_0x3a9d7c){_0x169f7b=_0x169f7b-0x0;var _0x6d0083=_0xf489[_0x169f7b];return _0x6d0083;};'use strict';var _=require(_0x9f48('0x0'));var util=require(_0x9f48('0x1'));var moment=require(_0x9f48('0x2'));var BPromise=require(_0x9f48('0x3'));var rs=require(_0x9f48('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9f48('0x5'))['db'];var utils=require(_0x9f48('0x6'));var logger=require(_0x9f48('0x7'))(_0x9f48('0x8'));var config=require('../../config/environment');var jayson=require(_0x9f48('0x9'));var client=jayson[_0x9f48('0xa')][_0x9f48('0xb')]({'port':0x232a});config[_0x9f48('0xc')]=_['defaults'](config[_0x9f48('0xc')],{'host':_0x9f48('0xd'),'port':0x18eb});var socket=require(_0x9f48('0xe'))(new Redis(config[_0x9f48('0xc')]));require('./chatGroup.socket')[_0x9f48('0xf')](socket);function respondWithRpcPromise(_0x2698ef,_0x2d8cf2,_0x4381c7){return new BPromise(function(_0x37f809,_0xb9736b){return client[_0x9f48('0x10')](_0x2698ef,_0x4381c7)[_0x9f48('0x11')](function(_0xb1a76d){logger['info'](_0x9f48('0x12'),_0x2d8cf2,_0x9f48('0x13'));logger[_0x9f48('0x14')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x2d8cf2,_0x9f48('0x13'),JSON[_0x9f48('0x15')](_0xb1a76d));if(_0xb1a76d[_0x9f48('0x16')]){if(_0xb1a76d[_0x9f48('0x16')][_0x9f48('0x17')]===0x1f4){logger[_0x9f48('0x16')](_0x9f48('0x12'),_0x2d8cf2,_0xb1a76d[_0x9f48('0x16')][_0x9f48('0x18')]);return _0xb9736b(_0xb1a76d[_0x9f48('0x16')][_0x9f48('0x18')]);}logger[_0x9f48('0x16')](_0x9f48('0x12'),_0x2d8cf2,_0xb1a76d[_0x9f48('0x16')]['message']);return _0x37f809(_0xb1a76d[_0x9f48('0x16')][_0x9f48('0x18')]);}else{logger[_0x9f48('0x19')]('ChatGroup,\x20%s,\x20%s',_0x2d8cf2,_0x9f48('0x13'));_0x37f809(_0xb1a76d[_0x9f48('0x1a')][_0x9f48('0x18')]);}})[_0x9f48('0x1b')](function(_0x3efb6d){logger[_0x9f48('0x16')](_0x9f48('0x12'),_0x2d8cf2,_0x3efb6d);_0xb9736b(_0x3efb6d);});});}