Built motion from commit 55091a5c.|2.6.30
[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 _0x28aa=['defaults','localhost','socket.io-emitter','./chatGroup.socket','register','request','info','ChatGroup,\x20%s,\x20%s','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis'];(function(_0x48a51c,_0x3a4e38){var _0x5a2aa4=function(_0x539df8){while(--_0x539df8){_0x48a51c['push'](_0x48a51c['shift']());}};_0x5a2aa4(++_0x3a4e38);}(_0x28aa,0xf8));var _0xa28a=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0x28aa[_0x187ee1];return _0x388160;};'use strict';var _=require('lodash');var util=require(_0xa28a('0x0'));var moment=require(_0xa28a('0x1'));var BPromise=require(_0xa28a('0x2'));var rs=require(_0xa28a('0x3'));var fs=require('fs');var Redis=require(_0xa28a('0x4'));var db=require(_0xa28a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa28a('0x6'))(_0xa28a('0x7'));var config=require(_0xa28a('0x8'));var jayson=require(_0xa28a('0x9'));var client=jayson['client'][_0xa28a('0xa')]({'port':0x232a});config[_0xa28a('0xb')]=_[_0xa28a('0xc')](config[_0xa28a('0xb')],{'host':_0xa28a('0xd'),'port':0x18eb});var socket=require(_0xa28a('0xe'))(new Redis(config[_0xa28a('0xb')]));require(_0xa28a('0xf'))[_0xa28a('0x10')](socket);function respondWithRpcPromise(_0x1caf6b,_0x3e8701,_0xc23755){return new BPromise(function(_0x19a508,_0x899bad){return client[_0xa28a('0x11')](_0x1caf6b,_0xc23755)['then'](function(_0x1c223c){logger[_0xa28a('0x12')](_0xa28a('0x13'),_0x3e8701,_0xa28a('0x14'));logger['debug'](_0xa28a('0x15'),_0x3e8701,_0xa28a('0x14'),JSON['stringify'](_0x1c223c));if(_0x1c223c[_0xa28a('0x16')]){if(_0x1c223c[_0xa28a('0x16')][_0xa28a('0x17')]===0x1f4){logger[_0xa28a('0x16')](_0xa28a('0x13'),_0x3e8701,_0x1c223c[_0xa28a('0x16')][_0xa28a('0x18')]);return _0x899bad(_0x1c223c[_0xa28a('0x16')][_0xa28a('0x18')]);}logger[_0xa28a('0x16')]('ChatGroup,\x20%s,\x20%s',_0x3e8701,_0x1c223c[_0xa28a('0x16')][_0xa28a('0x18')]);return _0x19a508(_0x1c223c[_0xa28a('0x16')]['message']);}else{logger[_0xa28a('0x12')](_0xa28a('0x13'),_0x3e8701,_0xa28a('0x14'));_0x19a508(_0x1c223c[_0xa28a('0x19')][_0xa28a('0x18')]);}})['catch'](function(_0x48093b){logger[_0xa28a('0x16')]('ChatGroup,\x20%s,\x20%s',_0x3e8701,_0x48093b);_0x899bad(_0x48093b);});});}