Built motion from commit (unavailable).|2.4.18
[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 _0x162c=['rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x1c93d1,_0x4c1700){var _0x27aa84=function(_0x4a6673){while(--_0x4a6673){_0x1c93d1['push'](_0x1c93d1['shift']());}};_0x27aa84(++_0x4c1700);}(_0x162c,0x138));var _0xc162=function(_0x477cb9,_0x1f151b){_0x477cb9=_0x477cb9-0x0;var _0x59f8ec=_0x162c[_0x477cb9];return _0x59f8ec;};'use strict';var _=require('lodash');var util=require(_0xc162('0x0'));var moment=require(_0xc162('0x1'));var BPromise=require(_0xc162('0x2'));var rs=require(_0xc162('0x3'));var fs=require('fs');var Redis=require(_0xc162('0x4'));var db=require(_0xc162('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc162('0x6'))(_0xc162('0x7'));var config=require(_0xc162('0x8'));var jayson=require(_0xc162('0x9'));var client=jayson['client'][_0xc162('0xa')]({'port':0x232a});config[_0xc162('0xb')]=_[_0xc162('0xc')](config[_0xc162('0xb')],{'host':_0xc162('0xd'),'port':0x18eb});var socket=require(_0xc162('0xe'))(new Redis(config[_0xc162('0xb')]));require(_0xc162('0xf'))[_0xc162('0x10')](socket);function respondWithRpcPromise(_0x384dee,_0x5d5044,_0x13a653){return new BPromise(function(_0x131661,_0x4eb348){return client[_0xc162('0x11')](_0x384dee,_0x13a653)[_0xc162('0x12')](function(_0x5c0d13){logger[_0xc162('0x13')](_0xc162('0x14'),_0x5d5044,_0xc162('0x15'));logger['debug'](_0xc162('0x16'),_0x5d5044,_0xc162('0x15'),JSON[_0xc162('0x17')](_0x5c0d13));if(_0x5c0d13[_0xc162('0x18')]){if(_0x5c0d13['error'][_0xc162('0x19')]===0x1f4){logger['error']('ChatGroup,\x20%s,\x20%s',_0x5d5044,_0x5c0d13['error'][_0xc162('0x1a')]);return _0x4eb348(_0x5c0d13[_0xc162('0x18')][_0xc162('0x1a')]);}logger[_0xc162('0x18')](_0xc162('0x14'),_0x5d5044,_0x5c0d13[_0xc162('0x18')][_0xc162('0x1a')]);return _0x131661(_0x5c0d13[_0xc162('0x18')][_0xc162('0x1a')]);}else{logger[_0xc162('0x13')](_0xc162('0x14'),_0x5d5044,'request\x20sent');_0x131661(_0x5c0d13[_0xc162('0x1b')]['message']);}})[_0xc162('0x1c')](function(_0x214180){logger['error'](_0xc162('0x14'),_0x5d5044,_0x214180);_0x4eb348(_0x214180);});});}