Built motion from commit 2b9af5da.|2.6.26
[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 _0x4ab0=['randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','redis','defaults','socket.io-emitter','./chatGroup.socket','register','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','util','moment','bluebird'];(function(_0x38054a,_0x32c753){var _0x2e2653=function(_0x317fa9){while(--_0x317fa9){_0x38054a['push'](_0x38054a['shift']());}};_0x2e2653(++_0x32c753);}(_0x4ab0,0xd5));var _0x04ab=function(_0x4c6fc1,_0x492bc1){_0x4c6fc1=_0x4c6fc1-0x0;var _0xe8450f=_0x4ab0[_0x4c6fc1];return _0xe8450f;};'use strict';var _=require('lodash');var util=require(_0x04ab('0x0'));var moment=require(_0x04ab('0x1'));var BPromise=require(_0x04ab('0x2'));var rs=require(_0x04ab('0x3'));var fs=require('fs');var Redis=require(_0x04ab('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x04ab('0x5'))(_0x04ab('0x6'));var config=require('../../config/environment');var jayson=require(_0x04ab('0x7'));var client=jayson[_0x04ab('0x8')]['http']({'port':0x232a});config[_0x04ab('0x9')]=_[_0x04ab('0xa')](config[_0x04ab('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x04ab('0xb'))(new Redis(config[_0x04ab('0x9')]));require(_0x04ab('0xc'))[_0x04ab('0xd')](socket);function respondWithRpcPromise(_0x4dc264,_0x252d00,_0x3608b7){return new BPromise(function(_0x3d003a,_0xaa3d){return client['request'](_0x4dc264,_0x3608b7)[_0x04ab('0xe')](function(_0x206539){logger[_0x04ab('0xf')](_0x04ab('0x10'),_0x252d00,_0x04ab('0x11'));logger[_0x04ab('0x12')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x252d00,_0x04ab('0x11'),JSON['stringify'](_0x206539));if(_0x206539[_0x04ab('0x13')]){if(_0x206539[_0x04ab('0x13')][_0x04ab('0x14')]===0x1f4){logger[_0x04ab('0x13')]('ChatGroup,\x20%s,\x20%s',_0x252d00,_0x206539['error']['message']);return _0xaa3d(_0x206539[_0x04ab('0x13')][_0x04ab('0x15')]);}logger[_0x04ab('0x13')](_0x04ab('0x10'),_0x252d00,_0x206539[_0x04ab('0x13')][_0x04ab('0x15')]);return _0x3d003a(_0x206539[_0x04ab('0x13')][_0x04ab('0x15')]);}else{logger[_0x04ab('0xf')](_0x04ab('0x10'),_0x252d00,'request\x20sent');_0x3d003a(_0x206539[_0x04ab('0x16')][_0x04ab('0x15')]);}})[_0x04ab('0x17')](function(_0xea243f){logger[_0x04ab('0x13')](_0x04ab('0x10'),_0x252d00,_0xea243f);_0xaa3d(_0xea243f);});});}