Built motion from commit (unavailable).|2.4.21
[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 _0x6e6d=['./chatGroup.socket','register','then','info','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatGroup,\x20%s,\x20%s','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x1f655b,_0x388165){var _0x4546ab=function(_0x2f8be2){while(--_0x2f8be2){_0x1f655b['push'](_0x1f655b['shift']());}};_0x4546ab(++_0x388165);}(_0x6e6d,0xb6));var _0xd6e6=function(_0x2abdb0,_0x36d4cd){_0x2abdb0=_0x2abdb0-0x0;var _0x3f723c=_0x6e6d[_0x2abdb0];return _0x3f723c;};'use strict';var _=require('lodash');var util=require(_0xd6e6('0x0'));var moment=require(_0xd6e6('0x1'));var BPromise=require(_0xd6e6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd6e6('0x3'));var db=require(_0xd6e6('0x4'))['db'];var utils=require(_0xd6e6('0x5'));var logger=require(_0xd6e6('0x6'))('rpc');var config=require(_0xd6e6('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd6e6('0x8')][_0xd6e6('0x9')]({'port':0x232a});config[_0xd6e6('0xa')]=_[_0xd6e6('0xb')](config[_0xd6e6('0xa')],{'host':_0xd6e6('0xc'),'port':0x18eb});var socket=require(_0xd6e6('0xd'))(new Redis(config['redis']));require(_0xd6e6('0xe'))[_0xd6e6('0xf')](socket);function respondWithRpcPromise(_0x2dfad7,_0x314e85,_0x51b487){return new BPromise(function(_0x4c56c7,_0x6dff3f){return client['request'](_0x2dfad7,_0x51b487)[_0xd6e6('0x10')](function(_0x16e12a){logger[_0xd6e6('0x11')]('ChatGroup,\x20%s,\x20%s',_0x314e85,_0xd6e6('0x12'));logger[_0xd6e6('0x13')](_0xd6e6('0x14'),_0x314e85,_0xd6e6('0x12'),JSON[_0xd6e6('0x15')](_0x16e12a));if(_0x16e12a['error']){if(_0x16e12a[_0xd6e6('0x16')][_0xd6e6('0x17')]===0x1f4){logger[_0xd6e6('0x16')]('ChatGroup,\x20%s,\x20%s',_0x314e85,_0x16e12a[_0xd6e6('0x16')]['message']);return _0x6dff3f(_0x16e12a[_0xd6e6('0x16')][_0xd6e6('0x18')]);}logger[_0xd6e6('0x16')]('ChatGroup,\x20%s,\x20%s',_0x314e85,_0x16e12a[_0xd6e6('0x16')]['message']);return _0x4c56c7(_0x16e12a[_0xd6e6('0x16')]['message']);}else{logger[_0xd6e6('0x11')](_0xd6e6('0x19'),_0x314e85,_0xd6e6('0x12'));_0x4c56c7(_0x16e12a[_0xd6e6('0x1a')][_0xd6e6('0x18')]);}})[_0xd6e6('0x1b')](function(_0x4fbb22){logger[_0xd6e6('0x16')](_0xd6e6('0x19'),_0x314e85,_0x4fbb22);_0x6dff3f(_0x4fbb22);});});}