Built motion from commit 9d1906d1.|2.5.40
[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 _0xfe65=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','request','then','info','ChatGroup,\x20%s,\x20%s','debug','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x4da356,_0x5235e1){var _0x321b07=function(_0x2bc6f4){while(--_0x2bc6f4){_0x4da356['push'](_0x4da356['shift']());}};_0x321b07(++_0x5235e1);}(_0xfe65,0xc4));var _0x5fe6=function(_0x37414b,_0x170937){_0x37414b=_0x37414b-0x0;var _0x52b7d6=_0xfe65[_0x37414b];return _0x52b7d6;};'use strict';var _=require(_0x5fe6('0x0'));var util=require(_0x5fe6('0x1'));var moment=require('moment');var BPromise=require(_0x5fe6('0x2'));var rs=require(_0x5fe6('0x3'));var fs=require('fs');var Redis=require(_0x5fe6('0x4'));var db=require(_0x5fe6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5fe6('0x6'))('rpc');var config=require(_0x5fe6('0x7'));var jayson=require(_0x5fe6('0x8'));var client=jayson['client'][_0x5fe6('0x9')]({'port':0x232a});config[_0x5fe6('0xa')]=_[_0x5fe6('0xb')](config['redis'],{'host':_0x5fe6('0xc'),'port':0x18eb});var socket=require(_0x5fe6('0xd'))(new Redis(config[_0x5fe6('0xa')]));require(_0x5fe6('0xe'))['register'](socket);function respondWithRpcPromise(_0x499225,_0x4a5eda,_0x57d251){return new BPromise(function(_0x19b4f7,_0x5f00e5){return client[_0x5fe6('0xf')](_0x499225,_0x57d251)[_0x5fe6('0x10')](function(_0x39e952){logger[_0x5fe6('0x11')](_0x5fe6('0x12'),_0x4a5eda,'request\x20sent');logger[_0x5fe6('0x13')](_0x5fe6('0x14'),_0x4a5eda,_0x5fe6('0x15'),JSON[_0x5fe6('0x16')](_0x39e952));if(_0x39e952[_0x5fe6('0x17')]){if(_0x39e952['error'][_0x5fe6('0x18')]===0x1f4){logger[_0x5fe6('0x17')](_0x5fe6('0x12'),_0x4a5eda,_0x39e952[_0x5fe6('0x17')][_0x5fe6('0x19')]);return _0x5f00e5(_0x39e952[_0x5fe6('0x17')][_0x5fe6('0x19')]);}logger[_0x5fe6('0x17')]('ChatGroup,\x20%s,\x20%s',_0x4a5eda,_0x39e952[_0x5fe6('0x17')][_0x5fe6('0x19')]);return _0x19b4f7(_0x39e952[_0x5fe6('0x17')][_0x5fe6('0x19')]);}else{logger[_0x5fe6('0x11')]('ChatGroup,\x20%s,\x20%s',_0x4a5eda,_0x5fe6('0x15'));_0x19b4f7(_0x39e952[_0x5fe6('0x1a')]['message']);}})[_0x5fe6('0x1b')](function(_0x50e681){logger[_0x5fe6('0x17')](_0x5fe6('0x12'),_0x4a5eda,_0x50e681);_0x5f00e5(_0x50e681);});});}