Built motion from commit 1fa89557.|2.6.10
[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 _0x76ed=['ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','then','info','debug','stringify','error','code','ChatGroup,\x20%s,\x20%s','message','result','lodash','util','bluebird','randomstring'];(function(_0x43e968,_0x30c352){var _0x44e53b=function(_0xef3882){while(--_0xef3882){_0x43e968['push'](_0x43e968['shift']());}};_0x44e53b(++_0x30c352);}(_0x76ed,0x1d0));var _0xd76e=function(_0x3a340f,_0x18653e){_0x3a340f=_0x3a340f-0x0;var _0x14ca55=_0x76ed[_0x3a340f];return _0x14ca55;};'use strict';var _=require(_0xd76e('0x0'));var util=require(_0xd76e('0x1'));var moment=require('moment');var BPromise=require(_0xd76e('0x2'));var rs=require(_0xd76e('0x3'));var fs=require('fs');var Redis=require(_0xd76e('0x4'));var db=require(_0xd76e('0x5'))['db'];var utils=require(_0xd76e('0x6'));var logger=require(_0xd76e('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xd76e('0x8'));var client=jayson[_0xd76e('0x9')][_0xd76e('0xa')]({'port':0x232a});config[_0xd76e('0xb')]=_[_0xd76e('0xc')](config[_0xd76e('0xb')],{'host':_0xd76e('0xd'),'port':0x18eb});var socket=require(_0xd76e('0xe'))(new Redis(config['redis']));require(_0xd76e('0xf'))[_0xd76e('0x10')](socket);function respondWithRpcPromise(_0x3fc332,_0x2037d7,_0x5df681){return new BPromise(function(_0xaebd5b,_0x7b3d4c){return client['request'](_0x3fc332,_0x5df681)[_0xd76e('0x11')](function(_0x807b29){logger[_0xd76e('0x12')]('ChatGroup,\x20%s,\x20%s',_0x2037d7,'request\x20sent');logger[_0xd76e('0x13')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x2037d7,'request\x20sent',JSON[_0xd76e('0x14')](_0x807b29));if(_0x807b29[_0xd76e('0x15')]){if(_0x807b29[_0xd76e('0x15')][_0xd76e('0x16')]===0x1f4){logger[_0xd76e('0x15')](_0xd76e('0x17'),_0x2037d7,_0x807b29['error'][_0xd76e('0x18')]);return _0x7b3d4c(_0x807b29[_0xd76e('0x15')][_0xd76e('0x18')]);}logger['error'](_0xd76e('0x17'),_0x2037d7,_0x807b29['error'][_0xd76e('0x18')]);return _0xaebd5b(_0x807b29['error'][_0xd76e('0x18')]);}else{logger['info']('ChatGroup,\x20%s,\x20%s',_0x2037d7,'request\x20sent');_0xaebd5b(_0x807b29[_0xd76e('0x19')][_0xd76e('0x18')]);}})['catch'](function(_0x13a9f9){logger[_0xd76e('0x15')](_0xd76e('0x17'),_0x2037d7,_0x13a9f9);_0x7b3d4c(_0x13a9f9);});});}