Built motion from commit 43538d75.|2.5.35
[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 _0x168b=['request\x20sent','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInternalMessage,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request'];(function(_0x163552,_0x2dadc2){var _0x3c2177=function(_0x348c1f){while(--_0x348c1f){_0x163552['push'](_0x163552['shift']());}};_0x3c2177(++_0x2dadc2);}(_0x168b,0x9b));var _0xb168=function(_0x5dc7bb,_0x3c2edc){_0x5dc7bb=_0x5dc7bb-0x0;var _0x3569c3=_0x168b[_0x5dc7bb];return _0x3569c3;};'use strict';var _=require(_0xb168('0x0'));var util=require(_0xb168('0x1'));var moment=require(_0xb168('0x2'));var BPromise=require('bluebird');var rs=require(_0xb168('0x3'));var fs=require('fs');var Redis=require(_0xb168('0x4'));var db=require(_0xb168('0x5'))['db'];var utils=require(_0xb168('0x6'));var logger=require(_0xb168('0x7'))(_0xb168('0x8'));var config=require('../../config/environment');var jayson=require(_0xb168('0x9'));var client=jayson[_0xb168('0xa')][_0xb168('0xb')]({'port':0x232a});config['redis']=_[_0xb168('0xc')](config[_0xb168('0xd')],{'host':_0xb168('0xe'),'port':0x18eb});var socket=require(_0xb168('0xf'))(new Redis(config[_0xb168('0xd')]));require(_0xb168('0x10'))[_0xb168('0x11')](socket);function respondWithRpcPromise(_0x1f122c,_0x3cd62b,_0x2811f6){return new BPromise(function(_0x2c95de,_0x1edc1d){return client[_0xb168('0x12')](_0x1f122c,_0x2811f6)['then'](function(_0x2f1790){logger['info']('ChatInternalMessage,\x20%s,\x20%s',_0x3cd62b,_0xb168('0x13'));logger['debug'](_0xb168('0x14'),_0x3cd62b,_0xb168('0x13'),JSON[_0xb168('0x15')](_0x2f1790));if(_0x2f1790[_0xb168('0x16')]){if(_0x2f1790[_0xb168('0x16')][_0xb168('0x17')]===0x1f4){logger['error'](_0xb168('0x18'),_0x3cd62b,_0x2f1790[_0xb168('0x16')][_0xb168('0x19')]);return _0x1edc1d(_0x2f1790['error'][_0xb168('0x19')]);}logger[_0xb168('0x16')](_0xb168('0x18'),_0x3cd62b,_0x2f1790[_0xb168('0x16')][_0xb168('0x19')]);return _0x2c95de(_0x2f1790['error'][_0xb168('0x19')]);}else{logger[_0xb168('0x1a')](_0xb168('0x18'),_0x3cd62b,_0xb168('0x13'));_0x2c95de(_0x2f1790[_0xb168('0x1b')][_0xb168('0x19')]);}})[_0xb168('0x1c')](function(_0x1770be){logger['error'](_0xb168('0x18'),_0x3cd62b,_0x1770be);_0x1edc1d(_0x1770be);});});}