Built motion from commit da24aabd.|2.6.20
[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 _0x83f7=['message','result','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','stringify','error','code','ChatGroup,\x20%s,\x20%s'];(function(_0x4be009,_0x3b5635){var _0x2eddfc=function(_0x500cc0){while(--_0x500cc0){_0x4be009['push'](_0x4be009['shift']());}};_0x2eddfc(++_0x3b5635);}(_0x83f7,0x84));var _0x783f=function(_0x14850d,_0xac0cbd){_0x14850d=_0x14850d-0x0;var _0x3f7406=_0x83f7[_0x14850d];return _0x3f7406;};'use strict';var _=require(_0x783f('0x0'));var util=require(_0x783f('0x1'));var moment=require(_0x783f('0x2'));var BPromise=require('bluebird');var rs=require(_0x783f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x783f('0x4'));var logger=require(_0x783f('0x5'))(_0x783f('0x6'));var config=require(_0x783f('0x7'));var jayson=require(_0x783f('0x8'));var client=jayson[_0x783f('0x9')][_0x783f('0xa')]({'port':0x232a});config[_0x783f('0xb')]=_['defaults'](config[_0x783f('0xb')],{'host':_0x783f('0xc'),'port':0x18eb});var socket=require(_0x783f('0xd'))(new Redis(config[_0x783f('0xb')]));require('./chatGroup.socket')[_0x783f('0xe')](socket);function respondWithRpcPromise(_0x53b61d,_0x195d40,_0x3f6d1b){return new BPromise(function(_0xc94050,_0x3deb73){return client[_0x783f('0xf')](_0x53b61d,_0x3f6d1b)[_0x783f('0x10')](function(_0x1661c9){logger[_0x783f('0x11')]('ChatGroup,\x20%s,\x20%s',_0x195d40,_0x783f('0x12'));logger[_0x783f('0x13')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x195d40,_0x783f('0x12'),JSON[_0x783f('0x14')](_0x1661c9));if(_0x1661c9[_0x783f('0x15')]){if(_0x1661c9[_0x783f('0x15')][_0x783f('0x16')]===0x1f4){logger['error'](_0x783f('0x17'),_0x195d40,_0x1661c9[_0x783f('0x15')][_0x783f('0x18')]);return _0x3deb73(_0x1661c9['error']['message']);}logger[_0x783f('0x15')](_0x783f('0x17'),_0x195d40,_0x1661c9[_0x783f('0x15')][_0x783f('0x18')]);return _0xc94050(_0x1661c9[_0x783f('0x15')][_0x783f('0x18')]);}else{logger['info'](_0x783f('0x17'),_0x195d40,_0x783f('0x12'));_0xc94050(_0x1661c9[_0x783f('0x19')][_0x783f('0x18')]);}})['catch'](function(_0x1ef1bb){logger[_0x783f('0x15')]('ChatGroup,\x20%s,\x20%s',_0x195d40,_0x1ef1bb);_0x3deb73(_0x1ef1bb);});});}