07288c961337fb853b1659896bfb7c1ad21db555
[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 _0x57d4=['ChatGroup,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','./chatGroup.socket','register','request','then','info'];(function(_0x34a717,_0x2c828c){var _0x4cf768=function(_0x4db333){while(--_0x4db333){_0x34a717['push'](_0x34a717['shift']());}};_0x4cf768(++_0x2c828c);}(_0x57d4,0x78));var _0x457d=function(_0x5204b2,_0x4a531a){_0x5204b2=_0x5204b2-0x0;var _0x8b129c=_0x57d4[_0x5204b2];return _0x8b129c;};'use strict';var _=require(_0x457d('0x0'));var util=require(_0x457d('0x1'));var moment=require('moment');var BPromise=require(_0x457d('0x2'));var rs=require(_0x457d('0x3'));var fs=require('fs');var Redis=require(_0x457d('0x4'));var db=require(_0x457d('0x5'))['db'];var utils=require(_0x457d('0x6'));var logger=require(_0x457d('0x7'))(_0x457d('0x8'));var config=require(_0x457d('0x9'));var jayson=require(_0x457d('0xa'));var client=jayson[_0x457d('0xb')][_0x457d('0xc')]({'port':0x232a});config['redis']=_[_0x457d('0xd')](config[_0x457d('0xe')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x457d('0xe')]));require(_0x457d('0xf'))[_0x457d('0x10')](socket);function respondWithRpcPromise(_0x559024,_0x5bc628,_0x568a59){return new BPromise(function(_0x2214e6,_0x38ec93){return client[_0x457d('0x11')](_0x559024,_0x568a59)[_0x457d('0x12')](function(_0x25ae31){logger[_0x457d('0x13')](_0x457d('0x14'),_0x5bc628,_0x457d('0x15'));logger[_0x457d('0x16')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x5bc628,_0x457d('0x15'),JSON[_0x457d('0x17')](_0x25ae31));if(_0x25ae31['error']){if(_0x25ae31['error'][_0x457d('0x18')]===0x1f4){logger[_0x457d('0x19')](_0x457d('0x14'),_0x5bc628,_0x25ae31[_0x457d('0x19')][_0x457d('0x1a')]);return _0x38ec93(_0x25ae31[_0x457d('0x19')][_0x457d('0x1a')]);}logger[_0x457d('0x19')]('ChatGroup,\x20%s,\x20%s',_0x5bc628,_0x25ae31[_0x457d('0x19')][_0x457d('0x1a')]);return _0x2214e6(_0x25ae31[_0x457d('0x19')]['message']);}else{logger['info'](_0x457d('0x14'),_0x5bc628,'request\x20sent');_0x2214e6(_0x25ae31[_0x457d('0x1b')][_0x457d('0x1a')]);}})['catch'](function(_0x2a22b6){logger['error']('ChatGroup,\x20%s,\x20%s',_0x5bc628,_0x2a22b6);_0x38ec93(_0x2a22b6);});});}