f0c1263dc139d2406c80da8edff9fc25b4afce2e
[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 _0xf769=['redis','./chatGroup.socket','register','request','then','info','ChatGroup,\x20%s,\x20%s','debug','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x209735,_0x2a1c65){var _0x44ee3f=function(_0x542b83){while(--_0x542b83){_0x209735['push'](_0x209735['shift']());}};_0x44ee3f(++_0x2a1c65);}(_0xf769,0xe8));var _0x9f76=function(_0x333767,_0x3e6f9c){_0x333767=_0x333767-0x0;var _0x51661b=_0xf769[_0x333767];return _0x51661b;};'use strict';var _=require(_0x9f76('0x0'));var util=require(_0x9f76('0x1'));var moment=require(_0x9f76('0x2'));var BPromise=require(_0x9f76('0x3'));var rs=require(_0x9f76('0x4'));var fs=require('fs');var Redis=require(_0x9f76('0x5'));var db=require(_0x9f76('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9f76('0x7'))(_0x9f76('0x8'));var config=require(_0x9f76('0x9'));var jayson=require(_0x9f76('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0x9f76('0xb')]=_['defaults'](config[_0x9f76('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9f76('0xb')]));require(_0x9f76('0xc'))[_0x9f76('0xd')](socket);function respondWithRpcPromise(_0xbd02c0,_0x16d400,_0x427bde){return new BPromise(function(_0x12155a,_0xff40e1){return client[_0x9f76('0xe')](_0xbd02c0,_0x427bde)[_0x9f76('0xf')](function(_0x3c86b8){logger[_0x9f76('0x10')](_0x9f76('0x11'),_0x16d400,'request\x20sent');logger[_0x9f76('0x12')](_0x9f76('0x13'),_0x16d400,_0x9f76('0x14'),JSON[_0x9f76('0x15')](_0x3c86b8));if(_0x3c86b8['error']){if(_0x3c86b8[_0x9f76('0x16')][_0x9f76('0x17')]===0x1f4){logger['error'](_0x9f76('0x11'),_0x16d400,_0x3c86b8['error'][_0x9f76('0x18')]);return _0xff40e1(_0x3c86b8['error']['message']);}logger[_0x9f76('0x16')](_0x9f76('0x11'),_0x16d400,_0x3c86b8[_0x9f76('0x16')]['message']);return _0x12155a(_0x3c86b8[_0x9f76('0x16')][_0x9f76('0x18')]);}else{logger[_0x9f76('0x10')](_0x9f76('0x11'),_0x16d400,_0x9f76('0x14'));_0x12155a(_0x3c86b8[_0x9f76('0x19')][_0x9f76('0x18')]);}})[_0x9f76('0x1a')](function(_0x23bf13){logger['error'](_0x9f76('0x11'),_0x16d400,_0x23bf13);_0xff40e1(_0x23bf13);});});}