64835d9b9733c099d6af996d88deff96f757ff77
[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 _0x858e=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./chatGroup.socket','register','request','then','ChatGroup,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','lodash','bluebird'];(function(_0x41b29e,_0x34b288){var _0xacd517=function(_0x3318df){while(--_0x3318df){_0x41b29e['push'](_0x41b29e['shift']());}};_0xacd517(++_0x34b288);}(_0x858e,0x178));var _0xe858=function(_0x5cd51d,_0x20d4fa){_0x5cd51d=_0x5cd51d-0x0;var _0x444608=_0x858e[_0x5cd51d];return _0x444608;};'use strict';var _=require(_0xe858('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe858('0x1'));var rs=require(_0xe858('0x2'));var fs=require('fs');var Redis=require(_0xe858('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe858('0x4'));var logger=require(_0xe858('0x5'))(_0xe858('0x6'));var config=require(_0xe858('0x7'));var jayson=require(_0xe858('0x8'));var client=jayson['client'][_0xe858('0x9')]({'port':0x232a});config[_0xe858('0xa')]=_['defaults'](config[_0xe858('0xa')],{'host':_0xe858('0xb'),'port':0x18eb});var socket=require(_0xe858('0xc'))(new Redis(config[_0xe858('0xa')]));require(_0xe858('0xd'))[_0xe858('0xe')](socket);function respondWithRpcPromise(_0x571ad6,_0x3ed125,_0x2dea6c){return new BPromise(function(_0x3677de,_0x128479){return client[_0xe858('0xf')](_0x571ad6,_0x2dea6c)[_0xe858('0x10')](function(_0x3014af){logger['info'](_0xe858('0x11'),_0x3ed125,'request\x20sent');logger[_0xe858('0x12')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x3ed125,_0xe858('0x13'),JSON[_0xe858('0x14')](_0x3014af));if(_0x3014af[_0xe858('0x15')]){if(_0x3014af['error'][_0xe858('0x16')]===0x1f4){logger[_0xe858('0x15')](_0xe858('0x11'),_0x3ed125,_0x3014af[_0xe858('0x15')]['message']);return _0x128479(_0x3014af[_0xe858('0x15')][_0xe858('0x17')]);}logger[_0xe858('0x15')]('ChatGroup,\x20%s,\x20%s',_0x3ed125,_0x3014af[_0xe858('0x15')]['message']);return _0x3677de(_0x3014af[_0xe858('0x15')][_0xe858('0x17')]);}else{logger[_0xe858('0x18')](_0xe858('0x11'),_0x3ed125,_0xe858('0x13'));_0x3677de(_0x3014af[_0xe858('0x19')][_0xe858('0x17')]);}})[_0xe858('0x1a')](function(_0x313401){logger['error']('ChatGroup,\x20%s,\x20%s',_0x3ed125,_0x313401);_0x128479(_0x313401);});});}