Built motion from commit (unavailable).|2.5.31
[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 _0x1bc6=['debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','request','then','ChatGroup,\x20%s,\x20%s','request\x20sent'];(function(_0x438f1b,_0x248e87){var _0x2c707b=function(_0x1223ab){while(--_0x1223ab){_0x438f1b['push'](_0x438f1b['shift']());}};_0x2c707b(++_0x248e87);}(_0x1bc6,0x16f));var _0x61bc=function(_0x424f0a,_0x1aeba5){_0x424f0a=_0x424f0a-0x0;var _0x50eeef=_0x1bc6[_0x424f0a];return _0x50eeef;};'use strict';var _=require(_0x61bc('0x0'));var util=require(_0x61bc('0x1'));var moment=require(_0x61bc('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x61bc('0x3'));var db=require(_0x61bc('0x4'))['db'];var utils=require(_0x61bc('0x5'));var logger=require('../../config/logger')(_0x61bc('0x6'));var config=require(_0x61bc('0x7'));var jayson=require(_0x61bc('0x8'));var client=jayson[_0x61bc('0x9')]['http']({'port':0x232a});config[_0x61bc('0xa')]=_[_0x61bc('0xb')](config[_0x61bc('0xa')],{'host':_0x61bc('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x61bc('0xa')]));require('./chatGroup.socket')['register'](socket);function respondWithRpcPromise(_0x504419,_0x1b9787,_0x4a6f42){return new BPromise(function(_0x4937a2,_0x58fae1){return client[_0x61bc('0xd')](_0x504419,_0x4a6f42)[_0x61bc('0xe')](function(_0x340552){logger['info'](_0x61bc('0xf'),_0x1b9787,_0x61bc('0x10'));logger[_0x61bc('0x11')](_0x61bc('0x12'),_0x1b9787,'request\x20sent',JSON[_0x61bc('0x13')](_0x340552));if(_0x340552[_0x61bc('0x14')]){if(_0x340552[_0x61bc('0x14')][_0x61bc('0x15')]===0x1f4){logger[_0x61bc('0x14')]('ChatGroup,\x20%s,\x20%s',_0x1b9787,_0x340552[_0x61bc('0x14')][_0x61bc('0x16')]);return _0x58fae1(_0x340552[_0x61bc('0x14')][_0x61bc('0x16')]);}logger[_0x61bc('0x14')](_0x61bc('0xf'),_0x1b9787,_0x340552['error'][_0x61bc('0x16')]);return _0x4937a2(_0x340552['error']['message']);}else{logger['info'](_0x61bc('0xf'),_0x1b9787,'request\x20sent');_0x4937a2(_0x340552[_0x61bc('0x17')]['message']);}})['catch'](function(_0x11888d){logger[_0x61bc('0x14')]('ChatGroup,\x20%s,\x20%s',_0x1b9787,_0x11888d);_0x58fae1(_0x11888d);});});}