Built motion from commit 39adb707.|2.6.14
[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 _0xa7ec=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','../../config/utils','../../config/logger','client','http','defaults','redis','localhost','./chatGroup.socket','register','request','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa7ec,0x14b));var _0xca7e=function(_0x2456e6,_0x589d1c){_0x2456e6=_0x2456e6-0x0;var _0x503485=_0xa7ec[_0x2456e6];return _0x503485;};'use strict';var _=require(_0xca7e('0x0'));var util=require(_0xca7e('0x1'));var moment=require(_0xca7e('0x2'));var BPromise=require(_0xca7e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xca7e('0x4'));var logger=require(_0xca7e('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xca7e('0x6')][_0xca7e('0x7')]({'port':0x232a});config['redis']=_[_0xca7e('0x8')](config[_0xca7e('0x9')],{'host':_0xca7e('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xca7e('0x9')]));require(_0xca7e('0xb'))[_0xca7e('0xc')](socket);function respondWithRpcPromise(_0x12a739,_0x1f18e8,_0x488d52){return new BPromise(function(_0xdb4d7a,_0x39c3e5){return client[_0xca7e('0xd')](_0x12a739,_0x488d52)['then'](function(_0x40c3dc){logger[_0xca7e('0xe')](_0xca7e('0xf'),_0x1f18e8,_0xca7e('0x10'));logger[_0xca7e('0x11')](_0xca7e('0x12'),_0x1f18e8,_0xca7e('0x10'),JSON[_0xca7e('0x13')](_0x40c3dc));if(_0x40c3dc[_0xca7e('0x14')]){if(_0x40c3dc[_0xca7e('0x14')][_0xca7e('0x15')]===0x1f4){logger[_0xca7e('0x14')]('ChatGroup,\x20%s,\x20%s',_0x1f18e8,_0x40c3dc['error'][_0xca7e('0x16')]);return _0x39c3e5(_0x40c3dc[_0xca7e('0x14')][_0xca7e('0x16')]);}logger[_0xca7e('0x14')]('ChatGroup,\x20%s,\x20%s',_0x1f18e8,_0x40c3dc['error']['message']);return _0xdb4d7a(_0x40c3dc[_0xca7e('0x14')][_0xca7e('0x16')]);}else{logger['info'](_0xca7e('0xf'),_0x1f18e8,_0xca7e('0x10'));_0xdb4d7a(_0x40c3dc[_0xca7e('0x17')][_0xca7e('0x16')]);}})[_0xca7e('0x18')](function(_0x38df76){logger[_0xca7e('0x14')](_0xca7e('0xf'),_0x1f18e8,_0x38df76);_0x39c3e5(_0x38df76);});});}