Built motion from commit (unavailable).|2.5.18
[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 _0x036e=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./chatGroup.socket','register','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','util','moment'];(function(_0x27d17f,_0x106e70){var _0x1b9268=function(_0x39eccf){while(--_0x39eccf){_0x27d17f['push'](_0x27d17f['shift']());}};_0x1b9268(++_0x106e70);}(_0x036e,0x1ec));var _0xe036=function(_0x3e8b44,_0xb6b419){_0x3e8b44=_0x3e8b44-0x0;var _0x5d4e88=_0x036e[_0x3e8b44];return _0x5d4e88;};'use strict';var _=require('lodash');var util=require(_0xe036('0x0'));var moment=require(_0xe036('0x1'));var BPromise=require(_0xe036('0x2'));var rs=require(_0xe036('0x3'));var fs=require('fs');var Redis=require(_0xe036('0x4'));var db=require(_0xe036('0x5'))['db'];var utils=require(_0xe036('0x6'));var logger=require(_0xe036('0x7'))('rpc');var config=require(_0xe036('0x8'));var jayson=require(_0xe036('0x9'));var client=jayson[_0xe036('0xa')][_0xe036('0xb')]({'port':0x232a});config[_0xe036('0xc')]=_[_0xe036('0xd')](config[_0xe036('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xe036('0xe'))(new Redis(config[_0xe036('0xc')]));require(_0xe036('0xf'))[_0xe036('0x10')](socket);function respondWithRpcPromise(_0x505f73,_0x1e89b1,_0xb27e11){return new BPromise(function(_0x36a3b5,_0x393103){return client['request'](_0x505f73,_0xb27e11)[_0xe036('0x11')](function(_0x341148){logger[_0xe036('0x12')](_0xe036('0x13'),_0x1e89b1,_0xe036('0x14'));logger[_0xe036('0x15')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x1e89b1,'request\x20sent',JSON[_0xe036('0x16')](_0x341148));if(_0x341148[_0xe036('0x17')]){if(_0x341148['error'][_0xe036('0x18')]===0x1f4){logger['error'](_0xe036('0x13'),_0x1e89b1,_0x341148[_0xe036('0x17')][_0xe036('0x19')]);return _0x393103(_0x341148[_0xe036('0x17')]['message']);}logger[_0xe036('0x17')](_0xe036('0x13'),_0x1e89b1,_0x341148[_0xe036('0x17')][_0xe036('0x19')]);return _0x36a3b5(_0x341148[_0xe036('0x17')][_0xe036('0x19')]);}else{logger[_0xe036('0x12')](_0xe036('0x13'),_0x1e89b1,_0xe036('0x14'));_0x36a3b5(_0x341148['result'][_0xe036('0x19')]);}})['catch'](function(_0x8ef67c){logger[_0xe036('0x17')](_0xe036('0x13'),_0x1e89b1,_0x8ef67c);_0x393103(_0x8ef67c);});});}