Built motion from commit (unavailable).|2.5.22
[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 _0xa0b6=['lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','client','http','defaults','redis','socket.io-emitter','./chatGroup.socket','register','then','info','ChatGroup,\x20%s,\x20%s','debug','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch'];(function(_0x34d6bd,_0x55b744){var _0x248396=function(_0x23f061){while(--_0x23f061){_0x34d6bd['push'](_0x34d6bd['shift']());}};_0x248396(++_0x55b744);}(_0xa0b6,0xe1));var _0x6a0b=function(_0x557fd2,_0x2c0a7a){_0x557fd2=_0x557fd2-0x0;var _0x1b54a2=_0xa0b6[_0x557fd2];return _0x1b54a2;};'use strict';var _=require(_0x6a0b('0x0'));var util=require(_0x6a0b('0x1'));var moment=require(_0x6a0b('0x2'));var BPromise=require(_0x6a0b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6a0b('0x4'))['db'];var utils=require(_0x6a0b('0x5'));var logger=require(_0x6a0b('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6a0b('0x7')][_0x6a0b('0x8')]({'port':0x232a});config['redis']=_[_0x6a0b('0x9')](config[_0x6a0b('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x6a0b('0xb'))(new Redis(config[_0x6a0b('0xa')]));require(_0x6a0b('0xc'))[_0x6a0b('0xd')](socket);function respondWithRpcPromise(_0x447a4a,_0x2931f6,_0x21ac86){return new BPromise(function(_0x480e7d,_0x13adac){return client['request'](_0x447a4a,_0x21ac86)[_0x6a0b('0xe')](function(_0x2339bc){logger[_0x6a0b('0xf')](_0x6a0b('0x10'),_0x2931f6,'request\x20sent');logger[_0x6a0b('0x11')](_0x6a0b('0x12'),_0x2931f6,_0x6a0b('0x13'),JSON[_0x6a0b('0x14')](_0x2339bc));if(_0x2339bc[_0x6a0b('0x15')]){if(_0x2339bc[_0x6a0b('0x15')][_0x6a0b('0x16')]===0x1f4){logger[_0x6a0b('0x15')]('ChatGroup,\x20%s,\x20%s',_0x2931f6,_0x2339bc['error']['message']);return _0x13adac(_0x2339bc['error'][_0x6a0b('0x17')]);}logger[_0x6a0b('0x15')]('ChatGroup,\x20%s,\x20%s',_0x2931f6,_0x2339bc[_0x6a0b('0x15')]['message']);return _0x480e7d(_0x2339bc['error'][_0x6a0b('0x17')]);}else{logger[_0x6a0b('0xf')]('ChatGroup,\x20%s,\x20%s',_0x2931f6,_0x6a0b('0x13'));_0x480e7d(_0x2339bc['result'][_0x6a0b('0x17')]);}})[_0x6a0b('0x18')](function(_0x2a73d2){logger[_0x6a0b('0x15')](_0x6a0b('0x10'),_0x2931f6,_0x2a73d2);_0x13adac(_0x2a73d2);});});}