Built motion from commit (unavailable).|2.5.4
[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 _0x4b8b=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','localhost','./chatGroup.socket','request','then','info','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatGroup,\x20%s,\x20%s','result','catch'];(function(_0x3e7df3,_0x2e57fb){var _0x48804f=function(_0x27bbb2){while(--_0x27bbb2){_0x3e7df3['push'](_0x3e7df3['shift']());}};_0x48804f(++_0x2e57fb);}(_0x4b8b,0x16c));var _0xb4b8=function(_0x119d5a,_0x19b457){_0x119d5a=_0x119d5a-0x0;var _0x15bff4=_0x4b8b[_0x119d5a];return _0x15bff4;};'use strict';var _=require(_0xb4b8('0x0'));var util=require(_0xb4b8('0x1'));var moment=require('moment');var BPromise=require(_0xb4b8('0x2'));var rs=require(_0xb4b8('0x3'));var fs=require('fs');var Redis=require(_0xb4b8('0x4'));var db=require(_0xb4b8('0x5'))['db'];var utils=require(_0xb4b8('0x6'));var logger=require('../../config/logger')(_0xb4b8('0x7'));var config=require('../../config/environment');var jayson=require(_0xb4b8('0x8'));var client=jayson[_0xb4b8('0x9')][_0xb4b8('0xa')]({'port':0x232a});config[_0xb4b8('0xb')]=_[_0xb4b8('0xc')](config[_0xb4b8('0xb')],{'host':_0xb4b8('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb4b8('0xb')]));require(_0xb4b8('0xe'))['register'](socket);function respondWithRpcPromise(_0x21dd9a,_0x4c9ef6,_0x2cbb88){return new BPromise(function(_0x3b34f1,_0x47dd76){return client[_0xb4b8('0xf')](_0x21dd9a,_0x2cbb88)[_0xb4b8('0x10')](function(_0x217e23){logger[_0xb4b8('0x11')]('ChatGroup,\x20%s,\x20%s',_0x4c9ef6,_0xb4b8('0x12'));logger[_0xb4b8('0x13')](_0xb4b8('0x14'),_0x4c9ef6,_0xb4b8('0x12'),JSON[_0xb4b8('0x15')](_0x217e23));if(_0x217e23[_0xb4b8('0x16')]){if(_0x217e23[_0xb4b8('0x16')][_0xb4b8('0x17')]===0x1f4){logger['error']('ChatGroup,\x20%s,\x20%s',_0x4c9ef6,_0x217e23[_0xb4b8('0x16')][_0xb4b8('0x18')]);return _0x47dd76(_0x217e23['error'][_0xb4b8('0x18')]);}logger[_0xb4b8('0x16')]('ChatGroup,\x20%s,\x20%s',_0x4c9ef6,_0x217e23[_0xb4b8('0x16')]['message']);return _0x3b34f1(_0x217e23[_0xb4b8('0x16')]['message']);}else{logger[_0xb4b8('0x11')](_0xb4b8('0x19'),_0x4c9ef6,_0xb4b8('0x12'));_0x3b34f1(_0x217e23[_0xb4b8('0x1a')][_0xb4b8('0x18')]);}})[_0xb4b8('0x1b')](function(_0x8905c2){logger['error']('ChatGroup,\x20%s,\x20%s',_0x4c9ef6,_0x8905c2);_0x47dd76(_0x8905c2);});});}