Built motion from commit (unavailable).|2.5.14
[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 _0xec92=['rpc','../../config/environment','client','http','redis','socket.io-emitter','./chatGroup.socket','register','request','then','request\x20sent','debug','stringify','error','code','ChatGroup,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger'];(function(_0x136567,_0x4c38cb){var _0x886cef=function(_0x2a2e17){while(--_0x2a2e17){_0x136567['push'](_0x136567['shift']());}};_0x886cef(++_0x4c38cb);}(_0xec92,0x107));var _0x2ec9=function(_0x557418,_0x51418f){_0x557418=_0x557418-0x0;var _0x3ffd0e=_0xec92[_0x557418];return _0x3ffd0e;};'use strict';var _=require(_0x2ec9('0x0'));var util=require(_0x2ec9('0x1'));var moment=require(_0x2ec9('0x2'));var BPromise=require(_0x2ec9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2ec9('0x4'));var db=require(_0x2ec9('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2ec9('0x6'))(_0x2ec9('0x7'));var config=require(_0x2ec9('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2ec9('0x9')][_0x2ec9('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x2ec9('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x2ec9('0xc'))(new Redis(config['redis']));require(_0x2ec9('0xd'))[_0x2ec9('0xe')](socket);function respondWithRpcPromise(_0x43f768,_0x54aa88,_0x154d2b){return new BPromise(function(_0x19eb80,_0x2d98b7){return client[_0x2ec9('0xf')](_0x43f768,_0x154d2b)[_0x2ec9('0x10')](function(_0x5c0a31){logger['info']('ChatGroup,\x20%s,\x20%s',_0x54aa88,_0x2ec9('0x11'));logger[_0x2ec9('0x12')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x54aa88,_0x2ec9('0x11'),JSON[_0x2ec9('0x13')](_0x5c0a31));if(_0x5c0a31[_0x2ec9('0x14')]){if(_0x5c0a31[_0x2ec9('0x14')][_0x2ec9('0x15')]===0x1f4){logger[_0x2ec9('0x14')](_0x2ec9('0x16'),_0x54aa88,_0x5c0a31[_0x2ec9('0x14')]['message']);return _0x2d98b7(_0x5c0a31['error'][_0x2ec9('0x17')]);}logger[_0x2ec9('0x14')](_0x2ec9('0x16'),_0x54aa88,_0x5c0a31[_0x2ec9('0x14')][_0x2ec9('0x17')]);return _0x19eb80(_0x5c0a31['error']['message']);}else{logger[_0x2ec9('0x18')](_0x2ec9('0x16'),_0x54aa88,_0x2ec9('0x11'));_0x19eb80(_0x5c0a31[_0x2ec9('0x19')][_0x2ec9('0x17')]);}})[_0x2ec9('0x1a')](function(_0x3ca685){logger[_0x2ec9('0x14')](_0x2ec9('0x16'),_0x54aa88,_0x3ca685);_0x2d98b7(_0x3ca685);});});}