Built motion from commit 00bf23f6.|2.6.16
[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 _0xe94a=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','then','ChatGroup,\x20%s,\x20%s','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe94a,0x1c7));var _0xae94=function(_0x15cdcb,_0x4340e9){_0x15cdcb=_0x15cdcb-0x0;var _0x37b069=_0xe94a[_0x15cdcb];return _0x37b069;};'use strict';var _=require(_0xae94('0x0'));var util=require(_0xae94('0x1'));var moment=require(_0xae94('0x2'));var BPromise=require('bluebird');var rs=require(_0xae94('0x3'));var fs=require('fs');var Redis=require(_0xae94('0x4'));var db=require(_0xae94('0x5'))['db'];var utils=require(_0xae94('0x6'));var logger=require(_0xae94('0x7'))(_0xae94('0x8'));var config=require('../../config/environment');var jayson=require(_0xae94('0x9'));var client=jayson[_0xae94('0xa')][_0xae94('0xb')]({'port':0x232a});config[_0xae94('0xc')]=_[_0xae94('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xae94('0xe'))(new Redis(config[_0xae94('0xc')]));require('./chatGroup.socket')[_0xae94('0xf')](socket);function respondWithRpcPromise(_0x35cd04,_0x3a5a57,_0x2fa556){return new BPromise(function(_0x1cb23d,_0x3fdafe){return client[_0xae94('0x10')](_0x35cd04,_0x2fa556)[_0xae94('0x11')](function(_0x4cb724){logger['info'](_0xae94('0x12'),_0x3a5a57,_0xae94('0x13'));logger['debug'](_0xae94('0x14'),_0x3a5a57,'request\x20sent',JSON[_0xae94('0x15')](_0x4cb724));if(_0x4cb724[_0xae94('0x16')]){if(_0x4cb724[_0xae94('0x16')][_0xae94('0x17')]===0x1f4){logger[_0xae94('0x16')]('ChatGroup,\x20%s,\x20%s',_0x3a5a57,_0x4cb724[_0xae94('0x16')][_0xae94('0x18')]);return _0x3fdafe(_0x4cb724[_0xae94('0x16')]['message']);}logger[_0xae94('0x16')]('ChatGroup,\x20%s,\x20%s',_0x3a5a57,_0x4cb724[_0xae94('0x16')]['message']);return _0x1cb23d(_0x4cb724[_0xae94('0x16')][_0xae94('0x18')]);}else{logger['info']('ChatGroup,\x20%s,\x20%s',_0x3a5a57,_0xae94('0x13'));_0x1cb23d(_0x4cb724[_0xae94('0x19')][_0xae94('0x18')]);}})[_0xae94('0x1a')](function(_0x5d4379){logger[_0xae94('0x16')](_0xae94('0x12'),_0x3a5a57,_0x5d4379);_0x3fdafe(_0x5d4379);});});}