e88e3f75f874e8e7c4c3b7be23d9312a8aa8df5e
[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 _0x9bbb=['./chatGroup.socket','request','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter'];(function(_0x3bcefb,_0x1e88c0){var _0x267bd9=function(_0x2097c8){while(--_0x2097c8){_0x3bcefb['push'](_0x3bcefb['shift']());}};_0x267bd9(++_0x1e88c0);}(_0x9bbb,0x1a4));var _0xb9bb=function(_0x50ebff,_0x5aec48){_0x50ebff=_0x50ebff-0x0;var _0x1596ca=_0x9bbb[_0x50ebff];return _0x1596ca;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb9bb('0x0'));var BPromise=require(_0xb9bb('0x1'));var rs=require(_0xb9bb('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb9bb('0x3'))['db'];var utils=require(_0xb9bb('0x4'));var logger=require(_0xb9bb('0x5'))(_0xb9bb('0x6'));var config=require(_0xb9bb('0x7'));var jayson=require(_0xb9bb('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0xb9bb('0x9')]=_['defaults'](config['redis'],{'host':_0xb9bb('0xa'),'port':0x18eb});var socket=require(_0xb9bb('0xb'))(new Redis(config[_0xb9bb('0x9')]));require(_0xb9bb('0xc'))['register'](socket);function respondWithRpcPromise(_0x3f5e98,_0x23fa00,_0x58a993){return new BPromise(function(_0x48c84a,_0xf8dc62){return client[_0xb9bb('0xd')](_0x3f5e98,_0x58a993)['then'](function(_0x5e472c){logger['info'](_0xb9bb('0xe'),_0x23fa00,_0xb9bb('0xf'));logger[_0xb9bb('0x10')](_0xb9bb('0x11'),_0x23fa00,_0xb9bb('0xf'),JSON[_0xb9bb('0x12')](_0x5e472c));if(_0x5e472c[_0xb9bb('0x13')]){if(_0x5e472c[_0xb9bb('0x13')][_0xb9bb('0x14')]===0x1f4){logger[_0xb9bb('0x13')](_0xb9bb('0xe'),_0x23fa00,_0x5e472c[_0xb9bb('0x13')]['message']);return _0xf8dc62(_0x5e472c['error'][_0xb9bb('0x15')]);}logger[_0xb9bb('0x13')](_0xb9bb('0xe'),_0x23fa00,_0x5e472c[_0xb9bb('0x13')][_0xb9bb('0x15')]);return _0x48c84a(_0x5e472c[_0xb9bb('0x13')]['message']);}else{logger[_0xb9bb('0x16')](_0xb9bb('0xe'),_0x23fa00,'request\x20sent');_0x48c84a(_0x5e472c[_0xb9bb('0x17')][_0xb9bb('0x15')]);}})['catch'](function(_0x1a4048){logger[_0xb9bb('0x13')]('ChatGroup,\x20%s,\x20%s',_0x23fa00,_0x1a4048);_0xf8dc62(_0x1a4048);});});}