Built motion from commit (unavailable).|2.5.8
[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 _0x3b48=['result','catch','lodash','util','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./chatGroup.socket','register','then','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x4b0ac2,_0x1c77b1){var _0x1aa730=function(_0x30bef6){while(--_0x30bef6){_0x4b0ac2['push'](_0x4b0ac2['shift']());}};_0x1aa730(++_0x1c77b1);}(_0x3b48,0xb8));var _0x83b4=function(_0x34bd77,_0x5caafa){_0x34bd77=_0x34bd77-0x0;var _0x3dab1d=_0x3b48[_0x34bd77];return _0x3dab1d;};'use strict';var _=require(_0x83b4('0x0'));var util=require(_0x83b4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x83b4('0x2'));var fs=require('fs');var Redis=require(_0x83b4('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x83b4('0x4'))(_0x83b4('0x5'));var config=require(_0x83b4('0x6'));var jayson=require(_0x83b4('0x7'));var client=jayson[_0x83b4('0x8')]['http']({'port':0x232a});config[_0x83b4('0x9')]=_[_0x83b4('0xa')](config[_0x83b4('0x9')],{'host':_0x83b4('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x83b4('0x9')]));require(_0x83b4('0xc'))[_0x83b4('0xd')](socket);function respondWithRpcPromise(_0x2685b7,_0x5d20c9,_0xb38724){return new BPromise(function(_0x1b64e9,_0x4cbb8c){return client['request'](_0x2685b7,_0xb38724)[_0x83b4('0xe')](function(_0x22d264){logger['info'](_0x83b4('0xf'),_0x5d20c9,_0x83b4('0x10'));logger[_0x83b4('0x11')](_0x83b4('0x12'),_0x5d20c9,_0x83b4('0x10'),JSON[_0x83b4('0x13')](_0x22d264));if(_0x22d264[_0x83b4('0x14')]){if(_0x22d264['error'][_0x83b4('0x15')]===0x1f4){logger[_0x83b4('0x14')]('ChatGroup,\x20%s,\x20%s',_0x5d20c9,_0x22d264[_0x83b4('0x14')]['message']);return _0x4cbb8c(_0x22d264['error']['message']);}logger[_0x83b4('0x14')](_0x83b4('0xf'),_0x5d20c9,_0x22d264[_0x83b4('0x14')][_0x83b4('0x16')]);return _0x1b64e9(_0x22d264[_0x83b4('0x14')][_0x83b4('0x16')]);}else{logger[_0x83b4('0x17')](_0x83b4('0xf'),_0x5d20c9,_0x83b4('0x10'));_0x1b64e9(_0x22d264[_0x83b4('0x18')][_0x83b4('0x16')]);}})[_0x83b4('0x19')](function(_0x15e62b){logger[_0x83b4('0x14')](_0x83b4('0xf'),_0x5d20c9,_0x15e62b);_0x4cbb8c(_0x15e62b);});});}