d2143fe3adc1ba048f25adc9b4715699eb41477d
[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 _0xef7c=['error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','./chatGroup.socket','register','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s'];(function(_0x5dba31,_0x4ee7d0){var _0x3ad428=function(_0x2c33b8){while(--_0x2c33b8){_0x5dba31['push'](_0x5dba31['shift']());}};_0x3ad428(++_0x4ee7d0);}(_0xef7c,0xa5));var _0xcef7=function(_0x483f3e,_0x3867ff){_0x483f3e=_0x483f3e-0x0;var _0x49e681=_0xef7c[_0x483f3e];return _0x49e681;};'use strict';var _=require(_0xcef7('0x0'));var util=require(_0xcef7('0x1'));var moment=require(_0xcef7('0x2'));var BPromise=require(_0xcef7('0x3'));var rs=require(_0xcef7('0x4'));var fs=require('fs');var Redis=require(_0xcef7('0x5'));var db=require(_0xcef7('0x6'))['db'];var utils=require(_0xcef7('0x7'));var logger=require(_0xcef7('0x8'))(_0xcef7('0x9'));var config=require(_0xcef7('0xa'));var jayson=require(_0xcef7('0xb'));var client=jayson['client'][_0xcef7('0xc')]({'port':0x232a});config['redis']=_[_0xcef7('0xd')](config[_0xcef7('0xe')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcef7('0xe')]));require(_0xcef7('0xf'))[_0xcef7('0x10')](socket);function respondWithRpcPromise(_0x401317,_0x580adc,_0x526b2c){return new BPromise(function(_0x16e18f,_0x1cb814){return client[_0xcef7('0x11')](_0x401317,_0x526b2c)[_0xcef7('0x12')](function(_0x4e2a46){logger[_0xcef7('0x13')](_0xcef7('0x14'),_0x580adc,_0xcef7('0x15'));logger[_0xcef7('0x16')](_0xcef7('0x17'),_0x580adc,_0xcef7('0x15'),JSON['stringify'](_0x4e2a46));if(_0x4e2a46['error']){if(_0x4e2a46[_0xcef7('0x18')]['code']===0x1f4){logger[_0xcef7('0x18')](_0xcef7('0x14'),_0x580adc,_0x4e2a46[_0xcef7('0x18')][_0xcef7('0x19')]);return _0x1cb814(_0x4e2a46[_0xcef7('0x18')][_0xcef7('0x19')]);}logger[_0xcef7('0x18')]('ChatGroup,\x20%s,\x20%s',_0x580adc,_0x4e2a46[_0xcef7('0x18')][_0xcef7('0x19')]);return _0x16e18f(_0x4e2a46[_0xcef7('0x18')][_0xcef7('0x19')]);}else{logger['info'](_0xcef7('0x14'),_0x580adc,_0xcef7('0x15'));_0x16e18f(_0x4e2a46[_0xcef7('0x1a')][_0xcef7('0x19')]);}})['catch'](function(_0x3b7005){logger[_0xcef7('0x18')](_0xcef7('0x14'),_0x580adc,_0x3b7005);_0x1cb814(_0x3b7005);});});}