Built motion from commit 14588770.|2.5.38
[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 _0x92e8=['./chatGroup.socket','then','info','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatGroup,\x20%s,\x20%s','message','result','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','socket.io-emitter'];(function(_0x203cf5,_0x8421e0){var _0x17a51d=function(_0x466b7a){while(--_0x466b7a){_0x203cf5['push'](_0x203cf5['shift']());}};_0x17a51d(++_0x8421e0);}(_0x92e8,0x7f));var _0x892e=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0x92e8[_0x50007c];return _0x5c1ec7;};'use strict';var _=require(_0x892e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x892e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x892e('0x2'));var db=require(_0x892e('0x3'))['db'];var utils=require(_0x892e('0x4'));var logger=require(_0x892e('0x5'))(_0x892e('0x6'));var config=require(_0x892e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x892e('0x8')]['http']({'port':0x232a});config[_0x892e('0x9')]=_['defaults'](config[_0x892e('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x892e('0xa'))(new Redis(config[_0x892e('0x9')]));require(_0x892e('0xb'))['register'](socket);function respondWithRpcPromise(_0x30aadd,_0x211bbf,_0x21e985){return new BPromise(function(_0x36ad8d,_0x7e5ba0){return client['request'](_0x30aadd,_0x21e985)[_0x892e('0xc')](function(_0x2cd23d){logger[_0x892e('0xd')]('ChatGroup,\x20%s,\x20%s',_0x211bbf,_0x892e('0xe'));logger['debug'](_0x892e('0xf'),_0x211bbf,_0x892e('0xe'),JSON[_0x892e('0x10')](_0x2cd23d));if(_0x2cd23d[_0x892e('0x11')]){if(_0x2cd23d[_0x892e('0x11')][_0x892e('0x12')]===0x1f4){logger[_0x892e('0x11')](_0x892e('0x13'),_0x211bbf,_0x2cd23d[_0x892e('0x11')][_0x892e('0x14')]);return _0x7e5ba0(_0x2cd23d[_0x892e('0x11')]['message']);}logger[_0x892e('0x11')]('ChatGroup,\x20%s,\x20%s',_0x211bbf,_0x2cd23d[_0x892e('0x11')]['message']);return _0x36ad8d(_0x2cd23d['error'][_0x892e('0x14')]);}else{logger[_0x892e('0xd')](_0x892e('0x13'),_0x211bbf,_0x892e('0xe'));_0x36ad8d(_0x2cd23d[_0x892e('0x15')][_0x892e('0x14')]);}})[_0x892e('0x16')](function(_0x5220c9){logger[_0x892e('0x11')](_0x892e('0x13'),_0x211bbf,_0x5220c9);_0x7e5ba0(_0x5220c9);});});}