Built motion from commit ae138b72.|2.6.28
[motion2.git] / server / api / chatInternalMessage / chatInternalMessage.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 _0x4720=['request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','error','code','message','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','info','ChatInternalMessage,\x20%s,\x20%s'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x4720,0x164));var _0x0472=function(_0xe1269d,_0x57b7c3){_0xe1269d=_0xe1269d-0x0;var _0x261ca1=_0x4720[_0xe1269d];return _0x261ca1;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0472('0x0'));var BPromise=require(_0x0472('0x1'));var rs=require(_0x0472('0x2'));var fs=require('fs');var Redis=require(_0x0472('0x3'));var db=require(_0x0472('0x4'))['db'];var utils=require(_0x0472('0x5'));var logger=require(_0x0472('0x6'))(_0x0472('0x7'));var config=require(_0x0472('0x8'));var jayson=require(_0x0472('0x9'));var client=jayson[_0x0472('0xa')][_0x0472('0xb')]({'port':0x232a});config[_0x0472('0xc')]=_[_0x0472('0xd')](config['redis'],{'host':_0x0472('0xe'),'port':0x18eb});var socket=require(_0x0472('0xf'))(new Redis(config['redis']));require('./chatInternalMessage.socket')[_0x0472('0x10')](socket);function respondWithRpcPromise(_0x39bf68,_0x53482d,_0x52f589){return new BPromise(function(_0x4188e9,_0x30c621){return client['request'](_0x39bf68,_0x52f589)['then'](function(_0x416622){logger[_0x0472('0x11')](_0x0472('0x12'),_0x53482d,_0x0472('0x13'));logger[_0x0472('0x14')](_0x0472('0x15'),_0x53482d,_0x0472('0x13'),JSON['stringify'](_0x416622));if(_0x416622[_0x0472('0x16')]){if(_0x416622[_0x0472('0x16')][_0x0472('0x17')]===0x1f4){logger[_0x0472('0x16')](_0x0472('0x12'),_0x53482d,_0x416622[_0x0472('0x16')]['message']);return _0x30c621(_0x416622['error'][_0x0472('0x18')]);}logger[_0x0472('0x16')](_0x0472('0x12'),_0x53482d,_0x416622[_0x0472('0x16')][_0x0472('0x18')]);return _0x4188e9(_0x416622[_0x0472('0x16')][_0x0472('0x18')]);}else{logger[_0x0472('0x11')]('ChatInternalMessage,\x20%s,\x20%s',_0x53482d,_0x0472('0x13'));_0x4188e9(_0x416622['result']['message']);}})['catch'](function(_0x32dda0){logger[_0x0472('0x16')](_0x0472('0x12'),_0x53482d,_0x32dda0);_0x30c621(_0x32dda0);});});}