bf7120439ed57371887a33e394b2e9cf4cc0eda2
[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 _0x28a2=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatGroup,\x20%s,\x20%s','info'];(function(_0xe45c3a,_0x183904){var _0x1bc5e8=function(_0x1c084b){while(--_0x1c084b){_0xe45c3a['push'](_0xe45c3a['shift']());}};_0x1bc5e8(++_0x183904);}(_0x28a2,0x141));var _0x228a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x28a2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x228a('0x0'));var util=require(_0x228a('0x1'));var moment=require(_0x228a('0x2'));var BPromise=require(_0x228a('0x3'));var rs=require(_0x228a('0x4'));var fs=require('fs');var Redis=require(_0x228a('0x5'));var db=require(_0x228a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x228a('0x7'))('rpc');var config=require(_0x228a('0x8'));var jayson=require(_0x228a('0x9'));var client=jayson[_0x228a('0xa')][_0x228a('0xb')]({'port':0x232a});config[_0x228a('0xc')]=_['defaults'](config[_0x228a('0xc')],{'host':_0x228a('0xd'),'port':0x18eb});var socket=require(_0x228a('0xe'))(new Redis(config[_0x228a('0xc')]));require('./chatGroup.socket')[_0x228a('0xf')](socket);function respondWithRpcPromise(_0x44dec4,_0x3b20dd,_0x1cb14a){return new BPromise(function(_0x2ccb62,_0x36d5a6){return client[_0x228a('0x10')](_0x44dec4,_0x1cb14a)[_0x228a('0x11')](function(_0x5b74cb){logger['info']('ChatGroup,\x20%s,\x20%s',_0x3b20dd,_0x228a('0x12'));logger[_0x228a('0x13')](_0x228a('0x14'),_0x3b20dd,_0x228a('0x12'),JSON[_0x228a('0x15')](_0x5b74cb));if(_0x5b74cb['error']){if(_0x5b74cb[_0x228a('0x16')][_0x228a('0x17')]===0x1f4){logger[_0x228a('0x16')]('ChatGroup,\x20%s,\x20%s',_0x3b20dd,_0x5b74cb['error'][_0x228a('0x18')]);return _0x36d5a6(_0x5b74cb[_0x228a('0x16')][_0x228a('0x18')]);}logger[_0x228a('0x16')](_0x228a('0x19'),_0x3b20dd,_0x5b74cb[_0x228a('0x16')][_0x228a('0x18')]);return _0x2ccb62(_0x5b74cb[_0x228a('0x16')]['message']);}else{logger[_0x228a('0x1a')]('ChatGroup,\x20%s,\x20%s',_0x3b20dd,_0x228a('0x12'));_0x2ccb62(_0x5b74cb[_0x228a('0x1b')][_0x228a('0x18')]);}})[_0x228a('0x1c')](function(_0x492595){logger['error'](_0x228a('0x19'),_0x3b20dd,_0x492595);_0x36d5a6(_0x492595);});});}