79dc27942c7f948e8b762b98ab10da3ff3321c48
[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 _0x2caf=['request','then','ChatGroup,\x20%s,\x20%s','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./chatGroup.socket','register'];(function(_0x117e78,_0x4c523c){var _0x4e6faa=function(_0x283b0c){while(--_0x283b0c){_0x117e78['push'](_0x117e78['shift']());}};_0x4e6faa(++_0x4c523c);}(_0x2caf,0x6a));var _0xf2ca=function(_0x401a8b,_0x88935b){_0x401a8b=_0x401a8b-0x0;var _0x18397c=_0x2caf[_0x401a8b];return _0x18397c;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xf2ca('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf2ca('0x1'));var db=require(_0xf2ca('0x2'))['db'];var utils=require(_0xf2ca('0x3'));var logger=require(_0xf2ca('0x4'))(_0xf2ca('0x5'));var config=require(_0xf2ca('0x6'));var jayson=require(_0xf2ca('0x7'));var client=jayson['client'][_0xf2ca('0x8')]({'port':0x232a});config[_0xf2ca('0x9')]=_[_0xf2ca('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xf2ca('0xb'))(new Redis(config[_0xf2ca('0x9')]));require(_0xf2ca('0xc'))[_0xf2ca('0xd')](socket);function respondWithRpcPromise(_0x1c1afd,_0x5be288,_0x1ecd50){return new BPromise(function(_0x34d82a,_0x30e975){return client[_0xf2ca('0xe')](_0x1c1afd,_0x1ecd50)[_0xf2ca('0xf')](function(_0x328d80){logger['info'](_0xf2ca('0x10'),_0x5be288,_0xf2ca('0x11'));logger['debug'](_0xf2ca('0x12'),_0x5be288,_0xf2ca('0x11'),JSON['stringify'](_0x328d80));if(_0x328d80['error']){if(_0x328d80[_0xf2ca('0x13')]['code']===0x1f4){logger[_0xf2ca('0x13')](_0xf2ca('0x10'),_0x5be288,_0x328d80[_0xf2ca('0x13')][_0xf2ca('0x14')]);return _0x30e975(_0x328d80[_0xf2ca('0x13')][_0xf2ca('0x14')]);}logger[_0xf2ca('0x13')]('ChatGroup,\x20%s,\x20%s',_0x5be288,_0x328d80[_0xf2ca('0x13')]['message']);return _0x34d82a(_0x328d80[_0xf2ca('0x13')]['message']);}else{logger[_0xf2ca('0x15')](_0xf2ca('0x10'),_0x5be288,'request\x20sent');_0x34d82a(_0x328d80[_0xf2ca('0x16')][_0xf2ca('0x14')]);}})[_0xf2ca('0x17')](function(_0x310504){logger[_0xf2ca('0x13')](_0xf2ca('0x10'),_0x5be288,_0x310504);_0x30e975(_0x310504);});});}