6da7ce848a767ed53f36b783696e7117a35f1b7c
[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 _0x1d44=['stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x8d69f4,_0x1c3f4b){var _0x5a3daa=function(_0x59e86d){while(--_0x59e86d){_0x8d69f4['push'](_0x8d69f4['shift']());}};_0x5a3daa(++_0x1c3f4b);}(_0x1d44,0xad));var _0x41d4=function(_0x3ebb04,_0x1a63a6){_0x3ebb04=_0x3ebb04-0x0;var _0x535db0=_0x1d44[_0x3ebb04];return _0x535db0;};'use strict';var _=require(_0x41d4('0x0'));var util=require(_0x41d4('0x1'));var moment=require(_0x41d4('0x2'));var BPromise=require(_0x41d4('0x3'));var rs=require(_0x41d4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x41d4('0x5'))['db'];var utils=require(_0x41d4('0x6'));var logger=require('../../config/logger')(_0x41d4('0x7'));var config=require(_0x41d4('0x8'));var jayson=require(_0x41d4('0x9'));var client=jayson[_0x41d4('0xa')][_0x41d4('0xb')]({'port':0x232a});config[_0x41d4('0xc')]=_[_0x41d4('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x41d4('0xe'))(new Redis(config['redis']));require(_0x41d4('0xf'))[_0x41d4('0x10')](socket);function respondWithRpcPromise(_0x99b8c4,_0x1b059f,_0x483fe1){return new BPromise(function(_0x4578ed,_0x21c6fe){return client[_0x41d4('0x11')](_0x99b8c4,_0x483fe1)[_0x41d4('0x12')](function(_0x2781ad){logger[_0x41d4('0x13')](_0x41d4('0x14'),_0x1b059f,_0x41d4('0x15'));logger[_0x41d4('0x16')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x1b059f,_0x41d4('0x15'),JSON[_0x41d4('0x17')](_0x2781ad));if(_0x2781ad[_0x41d4('0x18')]){if(_0x2781ad['error']['code']===0x1f4){logger['error'](_0x41d4('0x14'),_0x1b059f,_0x2781ad[_0x41d4('0x18')][_0x41d4('0x19')]);return _0x21c6fe(_0x2781ad[_0x41d4('0x18')][_0x41d4('0x19')]);}logger[_0x41d4('0x18')](_0x41d4('0x14'),_0x1b059f,_0x2781ad[_0x41d4('0x18')][_0x41d4('0x19')]);return _0x4578ed(_0x2781ad['error'][_0x41d4('0x19')]);}else{logger[_0x41d4('0x13')](_0x41d4('0x14'),_0x1b059f,_0x41d4('0x15'));_0x4578ed(_0x2781ad[_0x41d4('0x1a')]['message']);}})[_0x41d4('0x1b')](function(_0x339310){logger[_0x41d4('0x18')](_0x41d4('0x14'),_0x1b059f,_0x339310);_0x21c6fe(_0x339310);});});}