Built motion from commit d301b742.|2.6.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 _0x57cf=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','socket.io-emitter','request','then','ChatGroup,\x20%s,\x20%s','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','message','info','request\x20sent','result','catch','lodash','util','moment'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0x57cf,0x11b));var _0xf57c=function(_0x58b44a,_0x1a7aa6){_0x58b44a=_0x58b44a-0x0;var _0xd6779d=_0x57cf[_0x58b44a];return _0xd6779d;};'use strict';var _=require(_0xf57c('0x0'));var util=require(_0xf57c('0x1'));var moment=require(_0xf57c('0x2'));var BPromise=require(_0xf57c('0x3'));var rs=require(_0xf57c('0x4'));var fs=require('fs');var Redis=require(_0xf57c('0x5'));var db=require(_0xf57c('0x6'))['db'];var utils=require(_0xf57c('0x7'));var logger=require(_0xf57c('0x8'))(_0xf57c('0x9'));var config=require('../../config/environment');var jayson=require(_0xf57c('0xa'));var client=jayson['client'][_0xf57c('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0xf57c('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xf57c('0xd'))(new Redis(config[_0xf57c('0xc')]));require('./chatGroup.socket')['register'](socket);function respondWithRpcPromise(_0x1accbd,_0x3256d4,_0x259a60){return new BPromise(function(_0x2a19ef,_0x5f20f2){return client[_0xf57c('0xe')](_0x1accbd,_0x259a60)[_0xf57c('0xf')](function(_0x224d82){logger['info'](_0xf57c('0x10'),_0x3256d4,'request\x20sent');logger[_0xf57c('0x11')](_0xf57c('0x12'),_0x3256d4,'request\x20sent',JSON[_0xf57c('0x13')](_0x224d82));if(_0x224d82['error']){if(_0x224d82[_0xf57c('0x14')]['code']===0x1f4){logger[_0xf57c('0x14')](_0xf57c('0x10'),_0x3256d4,_0x224d82[_0xf57c('0x14')][_0xf57c('0x15')]);return _0x5f20f2(_0x224d82[_0xf57c('0x14')][_0xf57c('0x15')]);}logger[_0xf57c('0x14')](_0xf57c('0x10'),_0x3256d4,_0x224d82['error'][_0xf57c('0x15')]);return _0x2a19ef(_0x224d82['error'][_0xf57c('0x15')]);}else{logger[_0xf57c('0x16')]('ChatGroup,\x20%s,\x20%s',_0x3256d4,_0xf57c('0x17'));_0x2a19ef(_0x224d82[_0xf57c('0x18')][_0xf57c('0x15')]);}})[_0xf57c('0x19')](function(_0x9c27f0){logger['error'](_0xf57c('0x10'),_0x3256d4,_0x9c27f0);_0x5f20f2(_0x9c27f0);});});}