Built motion from commit 47436d59.|2.6.7
[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 _0x0a62=['request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','redis','defaults','localhost','request','then','info','ChatGroup,\x20%s,\x20%s','ChatGroup,\x20%s,\x20%s,\x20%s'];(function(_0x7df4d,_0x3e1a4f){var _0x54e5c6=function(_0x109831){while(--_0x109831){_0x7df4d['push'](_0x7df4d['shift']());}};_0x54e5c6(++_0x3e1a4f);}(_0x0a62,0x119));var _0x20a6=function(_0x31ced5,_0x5d5415){_0x31ced5=_0x31ced5-0x0;var _0x10d9e5=_0x0a62[_0x31ced5];return _0x10d9e5;};'use strict';var _=require(_0x20a6('0x0'));var util=require(_0x20a6('0x1'));var moment=require(_0x20a6('0x2'));var BPromise=require(_0x20a6('0x3'));var rs=require(_0x20a6('0x4'));var fs=require('fs');var Redis=require(_0x20a6('0x5'));var db=require(_0x20a6('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x20a6('0x7'));var config=require(_0x20a6('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x20a6('0x9')][_0x20a6('0xa')]({'port':0x232a});config[_0x20a6('0xb')]=_[_0x20a6('0xc')](config[_0x20a6('0xb')],{'host':_0x20a6('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatGroup.socket')['register'](socket);function respondWithRpcPromise(_0x3d3329,_0x14db80,_0x90b698){return new BPromise(function(_0x13b2fa,_0x4ceb69){return client[_0x20a6('0xe')](_0x3d3329,_0x90b698)[_0x20a6('0xf')](function(_0x337b53){logger[_0x20a6('0x10')](_0x20a6('0x11'),_0x14db80,'request\x20sent');logger['debug'](_0x20a6('0x12'),_0x14db80,_0x20a6('0x13'),JSON[_0x20a6('0x14')](_0x337b53));if(_0x337b53[_0x20a6('0x15')]){if(_0x337b53[_0x20a6('0x15')][_0x20a6('0x16')]===0x1f4){logger[_0x20a6('0x15')]('ChatGroup,\x20%s,\x20%s',_0x14db80,_0x337b53[_0x20a6('0x15')][_0x20a6('0x17')]);return _0x4ceb69(_0x337b53[_0x20a6('0x15')]['message']);}logger['error'](_0x20a6('0x11'),_0x14db80,_0x337b53[_0x20a6('0x15')][_0x20a6('0x17')]);return _0x13b2fa(_0x337b53['error']['message']);}else{logger[_0x20a6('0x10')](_0x20a6('0x11'),_0x14db80,_0x20a6('0x13'));_0x13b2fa(_0x337b53[_0x20a6('0x18')]['message']);}})['catch'](function(_0x2ed059){logger[_0x20a6('0x15')](_0x20a6('0x11'),_0x14db80,_0x2ed059);_0x4ceb69(_0x2ed059);});});}