Built motion from commit 936e8062.|2.5.33
[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 _0xfef2=['message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','request','then','request\x20sent','debug','error','code','ChatGroup,\x20%s,\x20%s'];(function(_0x486f4a,_0x478dc7){var _0x135d99=function(_0x434008){while(--_0x434008){_0x486f4a['push'](_0x486f4a['shift']());}};_0x135d99(++_0x478dc7);}(_0xfef2,0x1e0));var _0x2fef=function(_0x2adaa9,_0x298fc0){_0x2adaa9=_0x2adaa9-0x0;var _0x2a3124=_0xfef2[_0x2adaa9];return _0x2a3124;};'use strict';var _=require(_0x2fef('0x0'));var util=require(_0x2fef('0x1'));var moment=require(_0x2fef('0x2'));var BPromise=require('bluebird');var rs=require(_0x2fef('0x3'));var fs=require('fs');var Redis=require(_0x2fef('0x4'));var db=require(_0x2fef('0x5'))['db'];var utils=require(_0x2fef('0x6'));var logger=require('../../config/logger')(_0x2fef('0x7'));var config=require('../../config/environment');var jayson=require(_0x2fef('0x8'));var client=jayson[_0x2fef('0x9')][_0x2fef('0xa')]({'port':0x232a});config[_0x2fef('0xb')]=_[_0x2fef('0xc')](config[_0x2fef('0xb')],{'host':_0x2fef('0xd'),'port':0x18eb});var socket=require(_0x2fef('0xe'))(new Redis(config[_0x2fef('0xb')]));require(_0x2fef('0xf'))[_0x2fef('0x10')](socket);function respondWithRpcPromise(_0x4bce8d,_0x2042f5,_0x52982b){return new BPromise(function(_0x23a632,_0x389501){return client[_0x2fef('0x11')](_0x4bce8d,_0x52982b)[_0x2fef('0x12')](function(_0x3ac314){logger['info']('ChatGroup,\x20%s,\x20%s',_0x2042f5,_0x2fef('0x13'));logger[_0x2fef('0x14')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x2042f5,_0x2fef('0x13'),JSON['stringify'](_0x3ac314));if(_0x3ac314['error']){if(_0x3ac314[_0x2fef('0x15')][_0x2fef('0x16')]===0x1f4){logger[_0x2fef('0x15')](_0x2fef('0x17'),_0x2042f5,_0x3ac314[_0x2fef('0x15')][_0x2fef('0x18')]);return _0x389501(_0x3ac314[_0x2fef('0x15')]['message']);}logger['error'](_0x2fef('0x17'),_0x2042f5,_0x3ac314[_0x2fef('0x15')]['message']);return _0x23a632(_0x3ac314['error'][_0x2fef('0x18')]);}else{logger[_0x2fef('0x19')](_0x2fef('0x17'),_0x2042f5,_0x2fef('0x13'));_0x23a632(_0x3ac314[_0x2fef('0x1a')][_0x2fef('0x18')]);}})[_0x2fef('0x1b')](function(_0x394a20){logger[_0x2fef('0x15')](_0x2fef('0x17'),_0x2042f5,_0x394a20);_0x389501(_0x394a20);});});}