Built motion from commit (unavailable).|2.5.29
[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 _0x22d1=['message','info','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','ChatGroup,\x20%s,\x20%s','debug','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x48a170,_0x416802){var _0x2fdc76=function(_0x245a5e){while(--_0x245a5e){_0x48a170['push'](_0x48a170['shift']());}};_0x2fdc76(++_0x416802);}(_0x22d1,0x17e));var _0x122d=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x22d1[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x122d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x122d('0x1'));var rs=require(_0x122d('0x2'));var fs=require('fs');var Redis=require(_0x122d('0x3'));var db=require(_0x122d('0x4'))['db'];var utils=require(_0x122d('0x5'));var logger=require(_0x122d('0x6'))(_0x122d('0x7'));var config=require('../../config/environment');var jayson=require(_0x122d('0x8'));var client=jayson[_0x122d('0x9')]['http']({'port':0x232a});config[_0x122d('0xa')]=_[_0x122d('0xb')](config[_0x122d('0xa')],{'host':_0x122d('0xc'),'port':0x18eb});var socket=require(_0x122d('0xd'))(new Redis(config[_0x122d('0xa')]));require(_0x122d('0xe'))[_0x122d('0xf')](socket);function respondWithRpcPromise(_0x103b09,_0x1ed52d,_0x413bc8){return new BPromise(function(_0x3910be,_0xa17198){return client['request'](_0x103b09,_0x413bc8)['then'](function(_0x512e30){logger['info'](_0x122d('0x10'),_0x1ed52d,'request\x20sent');logger[_0x122d('0x11')](_0x122d('0x12'),_0x1ed52d,_0x122d('0x13'),JSON[_0x122d('0x14')](_0x512e30));if(_0x512e30['error']){if(_0x512e30[_0x122d('0x15')][_0x122d('0x16')]===0x1f4){logger[_0x122d('0x15')]('ChatGroup,\x20%s,\x20%s',_0x1ed52d,_0x512e30[_0x122d('0x15')][_0x122d('0x17')]);return _0xa17198(_0x512e30[_0x122d('0x15')][_0x122d('0x17')]);}logger[_0x122d('0x15')](_0x122d('0x10'),_0x1ed52d,_0x512e30[_0x122d('0x15')][_0x122d('0x17')]);return _0x3910be(_0x512e30['error'][_0x122d('0x17')]);}else{logger[_0x122d('0x18')](_0x122d('0x10'),_0x1ed52d,_0x122d('0x13'));_0x3910be(_0x512e30[_0x122d('0x19')]['message']);}})[_0x122d('0x1a')](function(_0x1f0122){logger['error'](_0x122d('0x10'),_0x1ed52d,_0x1f0122);_0xa17198(_0x1f0122);});});}