Built motion from commit 0900f080.|2.5.45
[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 _0xfcda=['message','result','catch','lodash','util','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./chatGroup.socket','register','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x1faf67,_0x41fa5f){var _0x17045d=function(_0x14a470){while(--_0x14a470){_0x1faf67['push'](_0x1faf67['shift']());}};_0x17045d(++_0x41fa5f);}(_0xfcda,0x198));var _0xafcd=function(_0x4e24e2,_0x4bf3cc){_0x4e24e2=_0x4e24e2-0x0;var _0x17975b=_0xfcda[_0x4e24e2];return _0x17975b;};'use strict';var _=require(_0xafcd('0x0'));var util=require(_0xafcd('0x1'));var moment=require('moment');var BPromise=require(_0xafcd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xafcd('0x3'));var logger=require(_0xafcd('0x4'))(_0xafcd('0x5'));var config=require(_0xafcd('0x6'));var jayson=require(_0xafcd('0x7'));var client=jayson[_0xafcd('0x8')][_0xafcd('0x9')]({'port':0x232a});config['redis']=_[_0xafcd('0xa')](config['redis'],{'host':_0xafcd('0xb'),'port':0x18eb});var socket=require(_0xafcd('0xc'))(new Redis(config[_0xafcd('0xd')]));require(_0xafcd('0xe'))[_0xafcd('0xf')](socket);function respondWithRpcPromise(_0x33b666,_0x4911d6,_0x8fe535){return new BPromise(function(_0x358964,_0x3a0d5e){return client[_0xafcd('0x10')](_0x33b666,_0x8fe535)[_0xafcd('0x11')](function(_0x212159){logger[_0xafcd('0x12')](_0xafcd('0x13'),_0x4911d6,_0xafcd('0x14'));logger['debug'](_0xafcd('0x15'),_0x4911d6,_0xafcd('0x14'),JSON['stringify'](_0x212159));if(_0x212159[_0xafcd('0x16')]){if(_0x212159[_0xafcd('0x16')][_0xafcd('0x17')]===0x1f4){logger[_0xafcd('0x16')](_0xafcd('0x13'),_0x4911d6,_0x212159['error']['message']);return _0x3a0d5e(_0x212159['error'][_0xafcd('0x18')]);}logger[_0xafcd('0x16')](_0xafcd('0x13'),_0x4911d6,_0x212159['error'][_0xafcd('0x18')]);return _0x358964(_0x212159[_0xafcd('0x16')][_0xafcd('0x18')]);}else{logger[_0xafcd('0x12')](_0xafcd('0x13'),_0x4911d6,'request\x20sent');_0x358964(_0x212159[_0xafcd('0x19')]['message']);}})[_0xafcd('0x1a')](function(_0x3e6449){logger[_0xafcd('0x16')](_0xafcd('0x13'),_0x4911d6,_0x3e6449);_0x3a0d5e(_0x3e6449);});});}