baf4e2c42941b3022e4d0aec53bcc546cf4c1ef9
[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 _0x0cd0=['register','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x0cd0,0xfe));var _0x00cd=function(_0x289f7c,_0x27aa3d){_0x289f7c=_0x289f7c-0x0;var _0x49f5cd=_0x0cd0[_0x289f7c];return _0x49f5cd;};'use strict';var _=require(_0x00cd('0x0'));var util=require('util');var moment=require(_0x00cd('0x1'));var BPromise=require(_0x00cd('0x2'));var rs=require(_0x00cd('0x3'));var fs=require('fs');var Redis=require(_0x00cd('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x00cd('0x5'));var logger=require('../../config/logger')(_0x00cd('0x6'));var config=require(_0x00cd('0x7'));var jayson=require(_0x00cd('0x8'));var client=jayson[_0x00cd('0x9')][_0x00cd('0xa')]({'port':0x232a});config[_0x00cd('0xb')]=_[_0x00cd('0xc')](config['redis'],{'host':_0x00cd('0xd'),'port':0x18eb});var socket=require(_0x00cd('0xe'))(new Redis(config['redis']));require(_0x00cd('0xf'))[_0x00cd('0x10')](socket);function respondWithRpcPromise(_0x5b4e49,_0x5a6b7b,_0x5a9189){return new BPromise(function(_0x391bcc,_0x569268){return client[_0x00cd('0x11')](_0x5b4e49,_0x5a9189)[_0x00cd('0x12')](function(_0x5d9eea){logger[_0x00cd('0x13')](_0x00cd('0x14'),_0x5a6b7b,_0x00cd('0x15'));logger[_0x00cd('0x16')](_0x00cd('0x17'),_0x5a6b7b,_0x00cd('0x15'),JSON[_0x00cd('0x18')](_0x5d9eea));if(_0x5d9eea[_0x00cd('0x19')]){if(_0x5d9eea[_0x00cd('0x19')][_0x00cd('0x1a')]===0x1f4){logger['error']('ChatGroup,\x20%s,\x20%s',_0x5a6b7b,_0x5d9eea[_0x00cd('0x19')][_0x00cd('0x1b')]);return _0x569268(_0x5d9eea['error']['message']);}logger[_0x00cd('0x19')](_0x00cd('0x14'),_0x5a6b7b,_0x5d9eea[_0x00cd('0x19')][_0x00cd('0x1b')]);return _0x391bcc(_0x5d9eea[_0x00cd('0x19')][_0x00cd('0x1b')]);}else{logger[_0x00cd('0x13')](_0x00cd('0x14'),_0x5a6b7b,_0x00cd('0x15'));_0x391bcc(_0x5d9eea[_0x00cd('0x1c')][_0x00cd('0x1b')]);}})[_0x00cd('0x1d')](function(_0x4b9bd9){logger['error']('ChatGroup,\x20%s,\x20%s',_0x5a6b7b,_0x4b9bd9);_0x569268(_0x4b9bd9);});});}