3db0065fe3d49da0d439273d0c7268e4e7acfb03
[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 _0x5c29=['info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','request','then','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x3dafc8,_0x3d90e2){var _0x874ea0=function(_0x1fa390){while(--_0x1fa390){_0x3dafc8['push'](_0x3dafc8['shift']());}};_0x874ea0(++_0x3d90e2);}(_0x5c29,0xbd));var _0x95c2=function(_0x1775a8,_0x40bc87){_0x1775a8=_0x1775a8-0x0;var _0x3d46a4=_0x5c29[_0x1775a8];return _0x3d46a4;};'use strict';var _=require(_0x95c2('0x0'));var util=require(_0x95c2('0x1'));var moment=require(_0x95c2('0x2'));var BPromise=require(_0x95c2('0x3'));var rs=require(_0x95c2('0x4'));var fs=require('fs');var Redis=require(_0x95c2('0x5'));var db=require(_0x95c2('0x6'))['db'];var utils=require(_0x95c2('0x7'));var logger=require(_0x95c2('0x8'))(_0x95c2('0x9'));var config=require(_0x95c2('0xa'));var jayson=require(_0x95c2('0xb'));var client=jayson[_0x95c2('0xc')]['http']({'port':0x232a});config[_0x95c2('0xd')]=_[_0x95c2('0xe')](config[_0x95c2('0xd')],{'host':_0x95c2('0xf'),'port':0x18eb});var socket=require(_0x95c2('0x10'))(new Redis(config[_0x95c2('0xd')]));require(_0x95c2('0x11'))[_0x95c2('0x12')](socket);function respondWithRpcPromise(_0x2efc93,_0x1c942e,_0x458402){return new BPromise(function(_0x55ecc1,_0x59c296){return client[_0x95c2('0x13')](_0x2efc93,_0x458402)[_0x95c2('0x14')](function(_0x3d4381){logger['info'](_0x95c2('0x15'),_0x1c942e,_0x95c2('0x16'));logger[_0x95c2('0x17')](_0x95c2('0x18'),_0x1c942e,_0x95c2('0x16'),JSON[_0x95c2('0x19')](_0x3d4381));if(_0x3d4381[_0x95c2('0x1a')]){if(_0x3d4381[_0x95c2('0x1a')]['code']===0x1f4){logger[_0x95c2('0x1a')]('ChatGroup,\x20%s,\x20%s',_0x1c942e,_0x3d4381[_0x95c2('0x1a')]['message']);return _0x59c296(_0x3d4381['error'][_0x95c2('0x1b')]);}logger[_0x95c2('0x1a')]('ChatGroup,\x20%s,\x20%s',_0x1c942e,_0x3d4381[_0x95c2('0x1a')]['message']);return _0x55ecc1(_0x3d4381[_0x95c2('0x1a')]['message']);}else{logger[_0x95c2('0x1c')](_0x95c2('0x15'),_0x1c942e,_0x95c2('0x16'));_0x55ecc1(_0x3d4381[_0x95c2('0x1d')]['message']);}})[_0x95c2('0x1e')](function(_0x137509){logger[_0x95c2('0x1a')](_0x95c2('0x15'),_0x1c942e,_0x137509);_0x59c296(_0x137509);});});}