becbc72df150a8ebbf4c2320d86e675a9aae947d
[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 _0x8243=['localhost','./chatGroup.socket','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults'];(function(_0x90362f,_0x2a6be1){var _0x31513c=function(_0x5992cf){while(--_0x5992cf){_0x90362f['push'](_0x90362f['shift']());}};_0x31513c(++_0x2a6be1);}(_0x8243,0xdb));var _0x3824=function(_0x4fe245,_0x17faa9){_0x4fe245=_0x4fe245-0x0;var _0x1f1d26=_0x8243[_0x4fe245];return _0x1f1d26;};'use strict';var _=require(_0x3824('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3824('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3824('0x2'));var db=require(_0x3824('0x3'))['db'];var utils=require(_0x3824('0x4'));var logger=require(_0x3824('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3824('0x6'));var client=jayson[_0x3824('0x7')][_0x3824('0x8')]({'port':0x232a});config[_0x3824('0x9')]=_[_0x3824('0xa')](config['redis'],{'host':_0x3824('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3824('0xc'))['register'](socket);function respondWithRpcPromise(_0x534d74,_0x5cfe9c,_0x56c219){return new BPromise(function(_0x3b2248,_0x21df57){return client[_0x3824('0xd')](_0x534d74,_0x56c219)[_0x3824('0xe')](function(_0x22cdc4){logger[_0x3824('0xf')](_0x3824('0x10'),_0x5cfe9c,_0x3824('0x11'));logger['debug'](_0x3824('0x12'),_0x5cfe9c,_0x3824('0x11'),JSON['stringify'](_0x22cdc4));if(_0x22cdc4[_0x3824('0x13')]){if(_0x22cdc4[_0x3824('0x13')]['code']===0x1f4){logger[_0x3824('0x13')](_0x3824('0x10'),_0x5cfe9c,_0x22cdc4['error'][_0x3824('0x14')]);return _0x21df57(_0x22cdc4[_0x3824('0x13')][_0x3824('0x14')]);}logger[_0x3824('0x13')](_0x3824('0x10'),_0x5cfe9c,_0x22cdc4[_0x3824('0x13')][_0x3824('0x14')]);return _0x3b2248(_0x22cdc4['error']['message']);}else{logger[_0x3824('0xf')](_0x3824('0x10'),_0x5cfe9c,_0x3824('0x11'));_0x3b2248(_0x22cdc4[_0x3824('0x15')][_0x3824('0x14')]);}})[_0x3824('0x16')](function(_0x5223c8){logger[_0x3824('0x13')](_0x3824('0x10'),_0x5cfe9c,_0x5223c8);_0x21df57(_0x5223c8);});});}