Built motion from commit (unavailable).|2.5.21
[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 _0x314b=['code','message','ChatGroup,\x20%s,\x20%s','result','catch','lodash','util','moment','randomstring','../../config/utils','rpc','jayson/promise','client','http','defaults','redis','socket.io-emitter','./chatGroup.socket','then','info','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x50876a,_0x2597de){var _0x3d2704=function(_0x131ccf){while(--_0x131ccf){_0x50876a['push'](_0x50876a['shift']());}};_0x3d2704(++_0x2597de);}(_0x314b,0x14a));var _0xb314=function(_0x456904,_0x4cb25c){_0x456904=_0x456904-0x0;var _0x4b0063=_0x314b[_0x456904];return _0x4b0063;};'use strict';var _=require(_0xb314('0x0'));var util=require(_0xb314('0x1'));var moment=require(_0xb314('0x2'));var BPromise=require('bluebird');var rs=require(_0xb314('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb314('0x4'));var logger=require('../../config/logger')(_0xb314('0x5'));var config=require('../../config/environment');var jayson=require(_0xb314('0x6'));var client=jayson[_0xb314('0x7')][_0xb314('0x8')]({'port':0x232a});config['redis']=_[_0xb314('0x9')](config[_0xb314('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xb314('0xb'))(new Redis(config[_0xb314('0xa')]));require(_0xb314('0xc'))['register'](socket);function respondWithRpcPromise(_0x456382,_0x1e40a0,_0xefa3da){return new BPromise(function(_0x4092ad,_0x5e4717){return client['request'](_0x456382,_0xefa3da)[_0xb314('0xd')](function(_0xaa2577){logger[_0xb314('0xe')]('ChatGroup,\x20%s,\x20%s',_0x1e40a0,_0xb314('0xf'));logger[_0xb314('0x10')](_0xb314('0x11'),_0x1e40a0,_0xb314('0xf'),JSON[_0xb314('0x12')](_0xaa2577));if(_0xaa2577[_0xb314('0x13')]){if(_0xaa2577['error'][_0xb314('0x14')]===0x1f4){logger['error']('ChatGroup,\x20%s,\x20%s',_0x1e40a0,_0xaa2577[_0xb314('0x13')][_0xb314('0x15')]);return _0x5e4717(_0xaa2577[_0xb314('0x13')][_0xb314('0x15')]);}logger['error'](_0xb314('0x16'),_0x1e40a0,_0xaa2577[_0xb314('0x13')]['message']);return _0x4092ad(_0xaa2577[_0xb314('0x13')]['message']);}else{logger[_0xb314('0xe')](_0xb314('0x16'),_0x1e40a0,'request\x20sent');_0x4092ad(_0xaa2577[_0xb314('0x17')]['message']);}})[_0xb314('0x18')](function(_0x8d90a8){logger[_0xb314('0x13')](_0xb314('0x16'),_0x1e40a0,_0x8d90a8);_0x5e4717(_0x8d90a8);});});}