2c5124bada189bac588d423602776512401341b9
[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 _0x8f1f=['rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./chatGroup.socket','register','request','then','info','ChatGroup,\x20%s,\x20%s','debug','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3f50a8,_0x2e6e75){var _0x148d7f=function(_0x26bbeb){while(--_0x26bbeb){_0x3f50a8['push'](_0x3f50a8['shift']());}};_0x148d7f(++_0x2e6e75);}(_0x8f1f,0xe1));var _0xf8f1=function(_0xa1181c,_0x1724a4){_0xa1181c=_0xa1181c-0x0;var _0x1ef296=_0x8f1f[_0xa1181c];return _0x1ef296;};'use strict';var _=require(_0xf8f1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf8f1('0x1'));var rs=require(_0xf8f1('0x2'));var fs=require('fs');var Redis=require(_0xf8f1('0x3'));var db=require(_0xf8f1('0x4'))['db'];var utils=require(_0xf8f1('0x5'));var logger=require(_0xf8f1('0x6'))(_0xf8f1('0x7'));var config=require(_0xf8f1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf8f1('0x9')][_0xf8f1('0xa')]({'port':0x232a});config[_0xf8f1('0xb')]=_[_0xf8f1('0xc')](config[_0xf8f1('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xf8f1('0xd'))(new Redis(config[_0xf8f1('0xb')]));require(_0xf8f1('0xe'))[_0xf8f1('0xf')](socket);function respondWithRpcPromise(_0x149942,_0x28811d,_0x22c3bc){return new BPromise(function(_0x4a4483,_0x44b31f){return client[_0xf8f1('0x10')](_0x149942,_0x22c3bc)[_0xf8f1('0x11')](function(_0x2acb97){logger[_0xf8f1('0x12')](_0xf8f1('0x13'),_0x28811d,'request\x20sent');logger[_0xf8f1('0x14')](_0xf8f1('0x15'),_0x28811d,_0xf8f1('0x16'),JSON[_0xf8f1('0x17')](_0x2acb97));if(_0x2acb97[_0xf8f1('0x18')]){if(_0x2acb97['error'][_0xf8f1('0x19')]===0x1f4){logger[_0xf8f1('0x18')](_0xf8f1('0x13'),_0x28811d,_0x2acb97[_0xf8f1('0x18')][_0xf8f1('0x1a')]);return _0x44b31f(_0x2acb97[_0xf8f1('0x18')][_0xf8f1('0x1a')]);}logger['error'](_0xf8f1('0x13'),_0x28811d,_0x2acb97[_0xf8f1('0x18')]['message']);return _0x4a4483(_0x2acb97[_0xf8f1('0x18')][_0xf8f1('0x1a')]);}else{logger[_0xf8f1('0x12')]('ChatGroup,\x20%s,\x20%s',_0x28811d,_0xf8f1('0x16'));_0x4a4483(_0x2acb97[_0xf8f1('0x1b')][_0xf8f1('0x1a')]);}})[_0xf8f1('0x1c')](function(_0x2cc2ec){logger['error'](_0xf8f1('0x13'),_0x28811d,_0x2cc2ec);_0x44b31f(_0x2cc2ec);});});}