Built motion from commit 6362bb75.|2.6.13
[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 _0xb715=['catch','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','client','http','redis','localhost','socket.io-emitter','./chatGroup.socket','register','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x37ae57,_0x3ff3a8){var _0xf9e711=function(_0x2ec496){while(--_0x2ec496){_0x37ae57['push'](_0x37ae57['shift']());}};_0xf9e711(++_0x3ff3a8);}(_0xb715,0x16d));var _0x5b71=function(_0x17c5c6,_0x3dc24e){_0x17c5c6=_0x17c5c6-0x0;var _0x53588b=_0xb715[_0x17c5c6];return _0x53588b;};'use strict';var _=require('lodash');var util=require(_0x5b71('0x0'));var moment=require('moment');var BPromise=require(_0x5b71('0x1'));var rs=require(_0x5b71('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5b71('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x5b71('0x4'))(_0x5b71('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5b71('0x6')][_0x5b71('0x7')]({'port':0x232a});config['redis']=_['defaults'](config[_0x5b71('0x8')],{'host':_0x5b71('0x9'),'port':0x18eb});var socket=require(_0x5b71('0xa'))(new Redis(config[_0x5b71('0x8')]));require(_0x5b71('0xb'))[_0x5b71('0xc')](socket);function respondWithRpcPromise(_0x2f42cb,_0x3e0f28,_0x370ec0){return new BPromise(function(_0x55718e,_0x34bdd1){return client[_0x5b71('0xd')](_0x2f42cb,_0x370ec0)[_0x5b71('0xe')](function(_0x25ea1d){logger[_0x5b71('0xf')](_0x5b71('0x10'),_0x3e0f28,_0x5b71('0x11'));logger[_0x5b71('0x12')](_0x5b71('0x13'),_0x3e0f28,_0x5b71('0x11'),JSON[_0x5b71('0x14')](_0x25ea1d));if(_0x25ea1d[_0x5b71('0x15')]){if(_0x25ea1d[_0x5b71('0x15')][_0x5b71('0x16')]===0x1f4){logger['error'](_0x5b71('0x10'),_0x3e0f28,_0x25ea1d[_0x5b71('0x15')][_0x5b71('0x17')]);return _0x34bdd1(_0x25ea1d[_0x5b71('0x15')][_0x5b71('0x17')]);}logger[_0x5b71('0x15')](_0x5b71('0x10'),_0x3e0f28,_0x25ea1d['error'][_0x5b71('0x17')]);return _0x55718e(_0x25ea1d[_0x5b71('0x15')]['message']);}else{logger[_0x5b71('0xf')](_0x5b71('0x10'),_0x3e0f28,'request\x20sent');_0x55718e(_0x25ea1d[_0x5b71('0x18')][_0x5b71('0x17')]);}})[_0x5b71('0x19')](function(_0x2c9700){logger[_0x5b71('0x15')](_0x5b71('0x10'),_0x3e0f28,_0x2c9700);_0x34bdd1(_0x2c9700);});});}