Built motion from commit 74d9782e.|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 _0x615a=['error','ChatGroup,\x20%s,\x20%s','message','info','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','request','then','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x32cd7f,_0x3c7b2a){var _0x197196=function(_0x3e0ebd){while(--_0x3e0ebd){_0x32cd7f['push'](_0x32cd7f['shift']());}};_0x197196(++_0x3c7b2a);}(_0x615a,0x119));var _0xa615=function(_0x2059df,_0x367401){_0x2059df=_0x2059df-0x0;var _0xdd848b=_0x615a[_0x2059df];return _0xdd848b;};'use strict';var _=require(_0xa615('0x0'));var util=require('util');var moment=require(_0xa615('0x1'));var BPromise=require('bluebird');var rs=require(_0xa615('0x2'));var fs=require('fs');var Redis=require(_0xa615('0x3'));var db=require(_0xa615('0x4'))['db'];var utils=require(_0xa615('0x5'));var logger=require('../../config/logger')(_0xa615('0x6'));var config=require(_0xa615('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa615('0x8')]['http']({'port':0x232a});config[_0xa615('0x9')]=_[_0xa615('0xa')](config[_0xa615('0x9')],{'host':_0xa615('0xb'),'port':0x18eb});var socket=require(_0xa615('0xc'))(new Redis(config['redis']));require(_0xa615('0xd'))['register'](socket);function respondWithRpcPromise(_0x2b952d,_0x3fbfe1,_0x5a6664){return new BPromise(function(_0x3b1698,_0xf1cbca){return client[_0xa615('0xe')](_0x2b952d,_0x5a6664)[_0xa615('0xf')](function(_0x2530ec){logger['info']('ChatGroup,\x20%s,\x20%s',_0x3fbfe1,_0xa615('0x10'));logger['debug'](_0xa615('0x11'),_0x3fbfe1,_0xa615('0x10'),JSON[_0xa615('0x12')](_0x2530ec));if(_0x2530ec[_0xa615('0x13')]){if(_0x2530ec['error']['code']===0x1f4){logger[_0xa615('0x13')](_0xa615('0x14'),_0x3fbfe1,_0x2530ec[_0xa615('0x13')][_0xa615('0x15')]);return _0xf1cbca(_0x2530ec[_0xa615('0x13')][_0xa615('0x15')]);}logger[_0xa615('0x13')](_0xa615('0x14'),_0x3fbfe1,_0x2530ec[_0xa615('0x13')][_0xa615('0x15')]);return _0x3b1698(_0x2530ec[_0xa615('0x13')][_0xa615('0x15')]);}else{logger[_0xa615('0x16')](_0xa615('0x14'),_0x3fbfe1,_0xa615('0x10'));_0x3b1698(_0x2530ec[_0xa615('0x17')][_0xa615('0x15')]);}})[_0xa615('0x18')](function(_0x1eb384){logger['error'](_0xa615('0x14'),_0x3fbfe1,_0x1eb384);_0xf1cbca(_0x1eb384);});});}