Built motion from commit (unavailable).|2.5.6
[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 _0x2f02=['moment','bluebird','randomstring','rpc','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./chatGroup.socket','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','error','code','message','lodash','util'];(function(_0x2fa26b,_0x4b37b8){var _0x485bd7=function(_0x3082d){while(--_0x3082d){_0x2fa26b['push'](_0x2fa26b['shift']());}};_0x485bd7(++_0x4b37b8);}(_0x2f02,0xc4));var _0x22f0=function(_0x3da144,_0x578cbd){_0x3da144=_0x3da144-0x0;var _0x13fdc7=_0x2f02[_0x3da144];return _0x13fdc7;};'use strict';var _=require(_0x22f0('0x0'));var util=require(_0x22f0('0x1'));var moment=require(_0x22f0('0x2'));var BPromise=require(_0x22f0('0x3'));var rs=require(_0x22f0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x22f0('0x5'));var config=require('../../config/environment');var jayson=require(_0x22f0('0x6'));var client=jayson['client'][_0x22f0('0x7')]({'port':0x232a});config['redis']=_[_0x22f0('0x8')](config[_0x22f0('0x9')],{'host':_0x22f0('0xa'),'port':0x18eb});var socket=require(_0x22f0('0xb'))(new Redis(config[_0x22f0('0x9')]));require(_0x22f0('0xc'))['register'](socket);function respondWithRpcPromise(_0x51c51d,_0xf3ee46,_0x20a349){return new BPromise(function(_0x4a20ea,_0x5c2f9c){return client[_0x22f0('0xd')](_0x51c51d,_0x20a349)[_0x22f0('0xe')](function(_0x2299d){logger[_0x22f0('0xf')](_0x22f0('0x10'),_0xf3ee46,_0x22f0('0x11'));logger[_0x22f0('0x12')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0xf3ee46,_0x22f0('0x11'),JSON['stringify'](_0x2299d));if(_0x2299d[_0x22f0('0x13')]){if(_0x2299d[_0x22f0('0x13')][_0x22f0('0x14')]===0x1f4){logger[_0x22f0('0x13')](_0x22f0('0x10'),_0xf3ee46,_0x2299d[_0x22f0('0x13')][_0x22f0('0x15')]);return _0x5c2f9c(_0x2299d[_0x22f0('0x13')][_0x22f0('0x15')]);}logger[_0x22f0('0x13')](_0x22f0('0x10'),_0xf3ee46,_0x2299d[_0x22f0('0x13')][_0x22f0('0x15')]);return _0x4a20ea(_0x2299d[_0x22f0('0x13')][_0x22f0('0x15')]);}else{logger[_0x22f0('0xf')](_0x22f0('0x10'),_0xf3ee46,'request\x20sent');_0x4a20ea(_0x2299d['result'][_0x22f0('0x15')]);}})['catch'](function(_0x25b24f){logger['error']('ChatGroup,\x20%s,\x20%s',_0xf3ee46,_0x25b24f);_0x5c2f9c(_0x25b24f);});});}