7e81797e051e96303928966ae5fdac26551d10f3
[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 _0x6b9b=['../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','info','request\x20sent','debug','stringify','error','code','ChatGroup,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x462053,_0x20ecad){var _0x355ec5=function(_0x246146){while(--_0x246146){_0x462053['push'](_0x462053['shift']());}};_0x355ec5(++_0x20ecad);}(_0x6b9b,0x1c1));var _0xb6b9=function(_0x52cef3,_0x4e970f){_0x52cef3=_0x52cef3-0x0;var _0x3adc4b=_0x6b9b[_0x52cef3];return _0x3adc4b;};'use strict';var _=require(_0xb6b9('0x0'));var util=require(_0xb6b9('0x1'));var moment=require(_0xb6b9('0x2'));var BPromise=require(_0xb6b9('0x3'));var rs=require(_0xb6b9('0x4'));var fs=require('fs');var Redis=require(_0xb6b9('0x5'));var db=require(_0xb6b9('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xb6b9('0x7'))(_0xb6b9('0x8'));var config=require(_0xb6b9('0x9'));var jayson=require(_0xb6b9('0xa'));var client=jayson['client'][_0xb6b9('0xb')]({'port':0x232a});config['redis']=_[_0xb6b9('0xc')](config[_0xb6b9('0xd')],{'host':_0xb6b9('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb6b9('0xd')]));require('./chatGroup.socket')['register'](socket);function respondWithRpcPromise(_0x16291d,_0x43289e,_0x233fd9){return new BPromise(function(_0x3b01b9,_0x237a55){return client['request'](_0x16291d,_0x233fd9)['then'](function(_0x35b631){logger[_0xb6b9('0xf')]('ChatGroup,\x20%s,\x20%s',_0x43289e,_0xb6b9('0x10'));logger[_0xb6b9('0x11')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x43289e,'request\x20sent',JSON[_0xb6b9('0x12')](_0x35b631));if(_0x35b631[_0xb6b9('0x13')]){if(_0x35b631[_0xb6b9('0x13')][_0xb6b9('0x14')]===0x1f4){logger['error'](_0xb6b9('0x15'),_0x43289e,_0x35b631[_0xb6b9('0x13')][_0xb6b9('0x16')]);return _0x237a55(_0x35b631['error'][_0xb6b9('0x16')]);}logger[_0xb6b9('0x13')](_0xb6b9('0x15'),_0x43289e,_0x35b631[_0xb6b9('0x13')][_0xb6b9('0x16')]);return _0x3b01b9(_0x35b631[_0xb6b9('0x13')][_0xb6b9('0x16')]);}else{logger[_0xb6b9('0xf')](_0xb6b9('0x15'),_0x43289e,_0xb6b9('0x10'));_0x3b01b9(_0x35b631['result'][_0xb6b9('0x16')]);}})[_0xb6b9('0x17')](function(_0x589dbc){logger[_0xb6b9('0x13')](_0xb6b9('0x15'),_0x43289e,_0x589dbc);_0x237a55(_0x589dbc);});});}